linux常用的一些操作

时间:2022-09-16 15:04:51

查看当前目录下的文件:ls

[root@VM_213_67_centos ~]# ls
anaconda-ks.cfg glibc-2.17 mysql wget-log
apache-tomcat-7.0.77 glibc-2.17.tar.xz mysql-5.6.26-linux-glibc2.5-x86_64.tar.gz
apache-tomcat-7.0.77.tar.gz jdk1.8.0_131 mysql-community-release-el7-5.noarch.rpm

进入选定的文件: cd apache-tomcat-7.0.77

[root@VM_213_67_centos ~]# cd apache-tomcat-7.0.77
[root@VM_213_67_centos apache-tomcat-7.0.77]# ls
LICENSE NOTICE RELEASE-NOTES RUNNING.txt bin conf lib logs temp webapps work
[root@VM_213_67_centos apache-tomcat-7.0.77]# cd conf
编辑当前的文件:vim server.xml
[root@VM_213_67_centos conf]# vim server.xml

<Executor name="tomcatThreadPool" namePrefix="catalina-exec-"
maxThreads="150" minSpareThreads="4"/>
-->


<!-- A "Connector" represents an endpoint by which requests are received
and responses are returned. Documentation at :
Java HTTP Connector: /docs/config/http.html (blocking & non-blocking)
Java AJP Connector: /docs/config/ajp.html
APR (HTTP/AJP) Connector: /docs/apr.html
Define a non-SSL HTTP/1.1 Connector on port 8080
-->
<Connector port="80" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
<!-- A "Connector" using the shared thread pool-->
<!--
<Connector executor="tomcatThreadPool"
port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
-->
<!-- Define a SSL HTTP/1.1 Connector on port 8443
This connector uses the BIO implementation that requires the JSSE
style configuration. When using the APR/native implementation, the
"server.xml" 144L, 6611C
查看端口是否开通:
[root@VM_213_67_centos bin]# ss -tanl

State      Recv-Q Send-Q                            Local Address:Port                              Peer Address:Port 
LISTEN 0 100 *:8009 *:*
LISTEN 16 100 *:80 *:*
LISTEN 0 128 *:22 *:*
LISTEN 0 100 127.0.0.1:25 *:*

从这里可以查看出我的80 端口,22端口,8009端口都是开放的。
接下来我们来看看linux下的安装JDK的命令,先让我们看看linux下是否有JDK的环境一般都是不可能有的。
[root@VM_213_67_centos bin]# java -version
-bash: java: command not found
[root@VM_213_67_centos bin]# javac
-bash: javac: command not found
[root@VM_213_67_centos bin]# java -version
-bash: java: command not found
先从oracle复制要下载的jdk的下载地址: http://www.Oracle.com/technetwork/Java/javase/downloads/jdk-7u1-download-513651.htm
解压jdk:tar zxvf jdk-7u71-linux-x64.tar.gz
把jdk安装在对应的文件比如我这里安装的位置:
[root@VM_213_67_centos ~]# ls
anaconda-ks.cfg glibc-2.17 mysql wget-log
apache-tomcat-7.0.77 glibc-2.17.tar.xz mysql-5.6.26-linux-glibc2.5-x86_64.tar.gz
apache-tomcat-7.0.77.tar.gz jdk1.8.0_131 mysql-community-release-el7-5.noarch.rpm
[root@VM_213_67_centos ~]# mv jdk1.8.0_131 /usr/local/jdk
[root@VM_213_67_centos ~]# cd /usr/local
[root@VM_213_67_centos local]# ls
bin etc games include jdk lib lib64 libexec qcloud sa sbin share src
[root@VM_213_67_centos local]# cd jdk
[root@VM_213_67_centos jdk]# ls
COPYRIGHT README.html THIRDPARTYLICENSEREADME.txt db javafx-src.zip lib release
LICENSE THIRDPARTYLICENSEREADME-JAVAFX.txt bin include jre man src.zip
[root@VM_213_67_centos jdk]# ls\
> ^C
[root@VM_213_67_centos jdk]# vim /etc/profile

上面是移动jdk到user文件下的local下面

接下进行jdk的编译:
[root@VM_213_67_centos jdk]# vim /etc/profile

输入i
加入内容如下:
export JAVA_HOME=/usr/local/jdk1.7.0_71
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$JAVA_HOME/bin:$PATH

输入“:wq”表示保存并退出

加载刚设置的变量:

source /etc/profile


查看:

[root@VM_213_67_centos jdk]# java -version

ava version "1.8.0_131"Java(TM) SE Runtime Environment (build 1.8.0_131-b11)Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)[root@VM_213_67_centos jdk]# cd /usr/local/tomcat-bash: cd: /usr/local/tomcat: No such file or directory

表示jdk安装成功


接下来的其他配置我就不写了不懂得可以私密博主:

[root@VM_213_67_centos apache-tomcat-7.0.77]# ./bin/startup.sh 
Using CATALINA_BASE: /root/apache-tomcat-7.0.77
Using CATALINA_HOME: /root/apache-tomcat-7.0.77
Using CATALINA_TMPDIR: /root/apache-tomcat-7.0.77/temp
Using JRE_HOME: /usr/local/jdk
Using CLASSPATH: /root/apache-tomcat-7.0.77/bin/bootstrap.jar:/root/apache-tomcat-7.0.77/bin/tomcat-juli.jar
Tomcat started.
[root@VM_213_67_centos apache-tomcat-7.0.77]# ss -tanl
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 0 1 127.0.0.1:8005 *:*
LISTEN 0 100 *:8009 *:*
LISTEN 19 100 *:80 *:*
LISTEN 0 128 *:22 *:*
LISTEN 0 100 127.0.0.1:25 *:*
[root@VM_213_67_centos apache-tomcat-7.0.77]# java -version
java version "1.8.0_131"
Java(TM) SE Runtime Environment (build 1.8.0_131-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)
[root@VM_213_67_centos apache-tomcat-7.0.77]# service firewalld stop
firewalld: unrecognized service
[root@VM_213_67_centos apache-tomcat-7.0.77]# service iptables sto[
Usage: iptables {start|stop|reload|restart|condrestart|status|panic|save}
[root@VM_213_67_centos apache-tomcat-7.0.77]# service iptables stop
[root@VM_213_67_centos apache-tomcat-7.0.77]# ss -tanl
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 0 1 127.0.0.1:8005 *:*
LISTEN 0 100 *:8009 *:*
LISTEN 19 100 *:80 *:*
LISTEN 0 128 *:22 *:*
LISTEN 0 100 127.0.0.1:25 *:*
[root@VM_213_67_centos apache-tomcat-7.0.77]# ls
LICENSE NOTICE RELEASE-NOTES RUNNING.txt bin conf lib logs temp webapps work
[root@VM_213_67_centos apache-tomcat-7.0.77]# reboot
[root@VM_213_67_centos apache-tomcat-7.0.77]#
Broadcast message from root@VM_213_67_centos
(/dev/pts/0) at 19:16 ...

The system is going down for reboot NOW!

Connection closed by foreign host.

Disconnected from remote host(lyj) at 19:16:17.

Type `help' to learn how to use Xshell prompt.
[c:\~]$

Connecting to 118.89.200.45:22...
Connection established.
To escape to local shell, press 'Ctrl+Alt+]'.

Last login: Wed May 17 16:45:17 2017 from 117.168.96.238
[root@VM_213_67_centos ~]# ls
anaconda-ks.cfg glibc-2.17 mysql-5.6.26-linux-glibc2.5-x86_64.tar.gz
apache-tomcat-7.0.77 glibc-2.17.tar.xz mysql-community-release-el7-5.noarch.rpm
apache-tomcat-7.0.77.tar.gz mysql wget-log
[root@VM_213_67_centos ~]# cd apache-tomcat-7.0.77
[root@VM_213_67_centos apache-tomcat-7.0.77]# ls
LICENSE NOTICE RELEASE-NOTES RUNNING.txt bin conf lib logs temp webapps work
[root@VM_213_67_centos apache-tomcat-7.0.77]# cd bin
[root@VM_213_67_centos bin]# ./startup.sh
Using CATALINA_BASE: /root/apache-tomcat-7.0.77
Using CATALINA_HOME: /root/apache-tomcat-7.0.77
Using CATALINA_TMPDIR: /root/apache-tomcat-7.0.77/temp
Using JRE_HOME: /usr/local/jdk
Using CLASSPATH: /root/apache-tomcat-7.0.77/bin/bootstrap.jar:/root/apache-tomcat-7.0.77/bin/tomcat-juli.jar
Tomcat started.
[root@VM_213_67_centos bin]# ^C
[root@VM_213_67_centos bin]# ls
bootstrap.jar commons-daemon.jar digest.sh startup.bat tool-wrapper.sh
catalina-tasks.xml configtest.bat setclasspath.bat startup.sh version.bat
catalina.bat configtest.sh setclasspath.sh tomcat-juli.jar version.sh
catalina.sh daemon.sh shutdown.bat tomcat-native.tar.gz
commons-daemon-native.tar.gz digest.bat shutdown.sh tool-wrapper.bat
[root@VM_213_67_centos bin]# cd -
/root/apache-tomcat-7.0.77
[root@VM_213_67_centos apache-tomcat-7.0.77]# ls
LICENSE NOTICE RELEASE-NOTES RUNNING.txt bin conf lib logs temp webapps work
[root@VM_213_67_centos apache-tomcat-7.0.77]# cd conf
[root@VM_213_67_centos conf]# vim server.xml
[root@VM_213_67_centos conf]#


最后装mysql的全部的步骤我也张贴出来吧!我也是第一次配置好,有空再整理出来给大家看吧!大家可以看看我配置的步骤在里面找找是否有你需要的东西,没有的话也不要喷博主,想了解web项目发布到linux服务器上的具体步骤也可以私信博主我,博主非常乐意解答。

[root@VM_213_67_centos ~]# cp -r mysql /usr/local/mysql
[root@VM_213_67_centos ~]# groupadd mysql
groupadd: group 'mysql' already exists
[root@VM_213_67_centos ~]# useradd -g mysql mysql
useradd: user 'mysql' already exists
[root@VM_213_67_centos ~]# cd /usr/local/mysql/<br>mkdir ./data/mysql
-bash: br: No such file or directory
[root@VM_213_67_centos ~]# cd /usr/local/mysql/<br>mkdir
-bash: br: No such file or directory
[root@VM_213_67_centos ~]# cd /usr/local/mysql/<br>mkdir
-bash: br: No such file or directory
[root@VM_213_67_centos ~]# cd /usr/local/mysql
[root@VM_213_67_centos mysql]# makdir ./data/mysql
-bash: makdir: command not found
[root@VM_213_67_centos mysql]# ls
COPYING INSTALL-BINARY README bin data docs include lib man my-new.cnf my.cnf mysql-test scripts share sql-bench support-files
[root@VM_213_67_centos mysql]# mkdir ./data/mysql
[root@VM_213_67_centos mysql]# chown -R mysql:mysql ./
[root@VM_213_67_centos mysql]# ./scripts/mysql_install_db --user=mysql --datadir=/usr/local/mysql/data/mysql
Installing MySQL system tables...2017-05-17 23:03:39 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2017-05-17 23:03:39 0 [Note] ./bin/mysqld (mysqld 5.6.26) starting as process 10671 ...
2017-05-17 23:03:39 10671 [Note] InnoDB: Using atomics to ref count buffer pool pages
2017-05-17 23:03:39 10671 [Note] InnoDB: The InnoDB memory heap is disabled
2017-05-17 23:03:39 10671 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2017-05-17 23:03:39 10671 [Note] InnoDB: Memory barrier is not used
2017-05-17 23:03:39 10671 [Note] InnoDB: Compressed tables use zlib 1.2.3
2017-05-17 23:03:39 10671 [Note] InnoDB: Using Linux native AIO
2017-05-17 23:03:39 10671 [Note] InnoDB: Using CPU crc32 instructions
2017-05-17 23:03:39 10671 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2017-05-17 23:03:39 10671 [Note] InnoDB: Completed initialization of buffer pool
2017-05-17 23:03:39 10671 [Note] InnoDB: The first specified data file ./ibdata1 did not exist: a new database to be created!
2017-05-17 23:03:39 10671 [Note] InnoDB: Setting file ./ibdata1 size to 12 MB
2017-05-17 23:03:39 10671 [Note] InnoDB: Database physically writes the file full: wait...
2017-05-17 23:03:39 10671 [Note] InnoDB: Setting log file ./ib_logfile101 size to 48 MB
2017-05-17 23:03:40 10671 [Note] InnoDB: Setting log file ./ib_logfile1 size to 48 MB
2017-05-17 23:03:40 10671 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0
2017-05-17 23:03:40 10671 [Warning] InnoDB: New log files created, LSN=45781
2017-05-17 23:03:40 10671 [Note] InnoDB: Doublewrite buffer not found: creating new
2017-05-17 23:03:40 10671 [Note] InnoDB: Doublewrite buffer created
2017-05-17 23:03:40 10671 [Note] InnoDB: 128 rollback segment(s) are active.
2017-05-17 23:03:40 10671 [Warning] InnoDB: Creating foreign key constraint system tables.
2017-05-17 23:03:40 10671 [Note] InnoDB: Foreign key constraint system tables created
2017-05-17 23:03:40 10671 [Note] InnoDB: Creating tablespace and datafile system tables.
2017-05-17 23:03:40 10671 [Note] InnoDB: Tablespace and datafile system tables created.
2017-05-17 23:03:40 10671 [Note] InnoDB: Waiting for purge to start
2017-05-17 23:03:40 10671 [Note] InnoDB: 5.6.26 started; log sequence number 0
2017-05-17 23:03:41 10671 [Note] Binlog end
2017-05-17 23:03:41 10671 [Note] InnoDB: FTS optimize thread exiting.
2017-05-17 23:03:41 10671 [Note] InnoDB: Starting shutdown...
2017-05-17 23:03:42 10671 [Note] InnoDB: Shutdown completed; log sequence number 1625977
OK

Filling help tables...2017-05-17 23:03:42 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2017-05-17 23:03:42 0 [Note] ./bin/mysqld (mysqld 5.6.26) starting as process 10693 ...
2017-05-17 23:03:42 10693 [Note] InnoDB: Using atomics to ref count buffer pool pages
2017-05-17 23:03:42 10693 [Note] InnoDB: The InnoDB memory heap is disabled
2017-05-17 23:03:42 10693 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2017-05-17 23:03:42 10693 [Note] InnoDB: Memory barrier is not used
2017-05-17 23:03:42 10693 [Note] InnoDB: Compressed tables use zlib 1.2.3
2017-05-17 23:03:42 10693 [Note] InnoDB: Using Linux native AIO
2017-05-17 23:03:42 10693 [Note] InnoDB: Using CPU crc32 instructions
2017-05-17 23:03:42 10693 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2017-05-17 23:03:42 10693 [Note] InnoDB: Completed initialization of buffer pool
2017-05-17 23:03:42 10693 [Note] InnoDB: Highest supported file format is Barracuda.
2017-05-17 23:03:42 10693 [Note] InnoDB: 128 rollback segment(s) are active.
2017-05-17 23:03:42 10693 [Note] InnoDB: Waiting for purge to start
2017-05-17 23:03:42 10693 [Note] InnoDB: 5.6.26 started; log sequence number 1625977
2017-05-17 23:03:42 10693 [Note] Binlog end
2017-05-17 23:03:42 10693 [Note] InnoDB: FTS optimize thread exiting.
2017-05-17 23:03:42 10693 [Note] InnoDB: Starting shutdown...
2017-05-17 23:03:44 10693 [Note] InnoDB: Shutdown completed; log sequence number 1625987
OK

To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:

./bin/mysqladmin -u root password 'new-password'
./bin/mysqladmin -u root -h VM_213_67_centos password 'new-password'

Alternatively you can run:

./bin/mysql_secure_installation

which will also give you the option of removing the test
databases and anonymous user created by default. This is
strongly recommended for production servers.

See the manual for more instructions.

You can start the MySQL daemon with:

cd . ; ./bin/mysqld_safe &

You can test the MySQL daemon with mysql-test-run.pl

cd mysql-test ; perl mysql-test-run.pl

Please report any problems at http://bugs.mysql.com/

The latest information about MySQL is available on the web at

http://www.mysql.com

Support MySQL by buying support/licenses at http://shop.mysql.com

WARNING: Found existing config file ./my.cnf on the system.
Because this file might be in use, it was not replaced,
but was used in bootstrap (unless you used --defaults-file)
and when you later start the server.
The new default config file was created as ./my-new.cnf,
please compare it with your file and take the changes you need.

WARNING: Default config file /etc/my.cnf exists on the system
This file will be read by default by the MySQL server
If you do not want to use this, either remove it, or use the
--defaults-file argument to mysqld_safe when starting the server

[root@VM_213_67_centos mysql]# cp support-files/mysql.server /ect/init.d/mysqld
cp: cannot create regular file `/ect/init.d/mysqld': No such file or directory
[root@VM_213_67_centos mysql]# cp support-files/mysql.server /etc/init.d/mysqld
[root@VM_213_67_centos mysql]# chmod 755 /etc/init.d/mysqld
[root@VM_213_67_centos mysql]# cp support-files/my-default.cnf /etc/my.cnf
cp: overwrite `/etc/my.cnf'? vi /etc/init.d/myssqld
[root@VM_213_67_centos mysql]# cp support-files/my-default.cnf /etc/my.cnf
cp: overwrite `/etc/my.cnf'? vi /etc/init.d/mysqld
[root@VM_213_67_centos mysql]# basedir=/usr/local/mysql/
[root@VM_213_67_centos mysql]# datadir=/usr/local/mysql/data/mysql
[root@VM_213_67_centos mysql]# service mysqld start
Starting MySQL. ERROR! The server quit without updating PID file (/var/lib/mysql/VM_213_67_centos.pid).
[root@VM_213_67_centos mysql]# ./mysql/bin/mysql -uroot
-bash: ./mysql/bin/mysql: No such file or directory
[root@VM_213_67_centos mysql]# service mysqld start
Starting MySQL. ERROR! The server quit without updating PID file (/var/lib/mysql/VM_213_67_centos.pid).
[root@VM_213_67_centos mysql]# ls
COPYING INSTALL-BINARY README bin data docs include lib man my-new.cnf my.cnf mysql-test scripts share sql-bench support-files
[root@VM_213_67_centos mysql]# ./bin/mysql uroot
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
[root@VM_213_67_centos mysql]# ./mysql/bin/mysql -uroot
-bash: ./mysql/bin/mysql: No such file or directory
[root@VM_213_67_centos mysql]# /ect/profile
-bash: /ect/profile: No such file or directory
[root@VM_213_67_centos mysql]# service mysqld status
ERROR! MySQL is not running, but lock file (/var/lock/subsys/mysql) exists
[root@VM_213_67_centos mysql]# service mysql start
Starting MySQL. ERROR! The server quit without updating PID file (/var/lib/mysql/VM_213_67_centos.pid).
[root@VM_213_67_centos mysql]# cd ~
[root@VM_213_67_centos ~]# service mysql start
Starting MySQL. ERROR! The server quit without updating PID file (/var/lib/mysql/VM_213_67_centos.pid).
[root@VM_213_67_centos ~]# service mysql stop
ERROR! MySQL server PID file could not be found!
[root@VM_213_67_centos ~]# cd/usr
-bash: cd/usr: No such file or directory
[root@VM_213_67_centos ~]# /usr
-bash: /usr: is a directory
[root@VM_213_67_centos ~]# ./usr
-bash: ./usr: No such file or directory
[root@VM_213_67_centos ~]# cd /usr/local/mysql
[root@VM_213_67_centos mysql]# ./scripts/mysql_install_db --user=mysql --datadir=/usr/local/mysql/data/mysql
Installing MySQL system tables...2017-05-17 23:17:37 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2017-05-17 23:17:37 0 [Note] ./bin/mysqld (mysqld 5.6.26) starting as process 12150 ...
2017-05-17 23:17:37 12150 [Note] InnoDB: Using atomics to ref count buffer pool pages
2017-05-17 23:17:37 12150 [Note] InnoDB: The InnoDB memory heap is disabled
2017-05-17 23:17:37 12150 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2017-05-17 23:17:37 12150 [Note] InnoDB: Memory barrier is not used
2017-05-17 23:17:37 12150 [Note] InnoDB: Compressed tables use zlib 1.2.3
2017-05-17 23:17:37 12150 [Note] InnoDB: Using Linux native AIO
2017-05-17 23:17:37 12150 [Note] InnoDB: Using CPU crc32 instructions
2017-05-17 23:17:37 12150 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2017-05-17 23:17:37 12150 [Note] InnoDB: Completed initialization of buffer pool
2017-05-17 23:17:37 12150 [Note] InnoDB: Highest supported file format is Barracuda.
2017-05-17 23:17:37 12150 [Note] InnoDB: 128 rollback segment(s) are active.
2017-05-17 23:17:37 12150 [Note] InnoDB: Waiting for purge to start
2017-05-17 23:17:37 12150 [Note] InnoDB: 5.6.26 started; log sequence number 1625987
2017-05-17 23:17:37 12150 [Note] Binlog end
2017-05-17 23:17:37 12150 [Note] InnoDB: FTS optimize thread exiting.
2017-05-17 23:17:37 12150 [Note] InnoDB: Starting shutdown...
2017-05-17 23:17:39 12150 [Note] InnoDB: Shutdown completed; log sequence number 1625997
OK

Filling help tables...2017-05-17 23:17:39 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2017-05-17 23:17:39 0 [Note] ./bin/mysqld (mysqld 5.6.26) starting as process 12173 ...
2017-05-17 23:17:39 12173 [Note] InnoDB: Using atomics to ref count buffer pool pages
2017-05-17 23:17:39 12173 [Note] InnoDB: The InnoDB memory heap is disabled
2017-05-17 23:17:39 12173 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2017-05-17 23:17:39 12173 [Note] InnoDB: Memory barrier is not used
2017-05-17 23:17:39 12173 [Note] InnoDB: Compressed tables use zlib 1.2.3
2017-05-17 23:17:39 12173 [Note] InnoDB: Using Linux native AIO
2017-05-17 23:17:39 12173 [Note] InnoDB: Using CPU crc32 instructions
2017-05-17 23:17:39 12173 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2017-05-17 23:17:39 12173 [Note] InnoDB: Completed initialization of buffer pool
2017-05-17 23:17:39 12173 [Note] InnoDB: Highest supported file format is Barracuda.
2017-05-17 23:17:39 12173 [Note] InnoDB: 128 rollback segment(s) are active.
2017-05-17 23:17:39 12173 [Note] InnoDB: Waiting for purge to start
2017-05-17 23:17:39 12173 [Note] InnoDB: 5.6.26 started; log sequence number 1625997
2017-05-17 23:17:39 12173 [Note] Binlog end
2017-05-17 23:17:39 12173 [Note] InnoDB: FTS optimize thread exiting.
2017-05-17 23:17:39 12173 [Note] InnoDB: Starting shutdown...
2017-05-17 23:17:41 12173 [Note] InnoDB: Shutdown completed; log sequence number 1626007
OK

To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:

./bin/mysqladmin -u root password 'new-password'
./bin/mysqladmin -u root -h VM_213_67_centos password 'new-password'

Alternatively you can run:

./bin/mysql_secure_installation

which will also give you the option of removing the test
databases and anonymous user created by default. This is
strongly recommended for production servers.

See the manual for more instructions.

You can start the MySQL daemon with:

cd . ; ./bin/mysqld_safe &

You can test the MySQL daemon with mysql-test-run.pl

cd mysql-test ; perl mysql-test-run.pl

Please report any problems at http://bugs.mysql.com/

The latest information about MySQL is available on the web at

http://www.mysql.com

Support MySQL by buying support/licenses at http://shop.mysql.com

WARNING: Found existing config file ./my.cnf on the system.
Because this file might be in use, it was not replaced,
but was used in bootstrap (unless you used --defaults-file)
and when you later start the server.
The new default config file was created as ./my-new.cnf,
please compare it with your file and take the changes you need.

WARNING: Default config file /etc/my.cnf exists on the system
This file will be read by default by the MySQL server
If you do not want to use this, either remove it, or use the
--defaults-file argument to mysqld_safe when starting the server

[root@VM_213_67_centos mysql]# basedir=/usr/local/mysql/
[root@VM_213_67_centos mysql]# datadir=/usr/local/mysql/data/mysql
[root@VM_213_67_centos mysql]# service mysqld start
Starting MySQL. ERROR! The server quit without updating PID file (/var/lib/mysql/VM_213_67_centos.pid).
[root@VM_213_67_centos mysql]# cp support-files/mysql.server /etc/init.d/mysqld
cp: overwrite `/etc/init.d/mysqld'? chmod 755 /etc/init.d/mysqld
[root@VM_213_67_centos mysql]# cp support-files/my-default.cnf /etc/my.cnf
cp: overwrite `/etc/my.cnf'? vi /etc/init.d/mysqld
[root@VM_213_67_centos mysql]# basedir=/usr/local/mysql/
[root@VM_213_67_centos mysql]# cp support-files/mysql.server /etc/init.d/mysqld
cp: overwrite `/etc/init.d/mysqld'? yes
[root@VM_213_67_centos mysql]# cp support-files/mysql.server
cp: missing destination file operand after `support-files/mysql.server'
Try `cp --help' for more information.
[root@VM_213_67_centos mysql]# /etc/init.d/mysqld
Usage: mysqld {start|stop|restart|reload|force-reload|status} [ MySQL server options ]
[root@VM_213_67_centos mysql]# chmod 755
chmod: missing operand after `755'
Try `chmod --help' for more information.
[root@VM_213_67_centos mysql]# chmod 755 /etc/init.d/mysqld
[root@VM_213_67_centos mysql]# cp support-files/my-default.cnf
cp: missing destination file operand after `support-files/my-default.cnf'
Try `cp --help' for more information.
[root@VM_213_67_centos mysql]# /etc/my.cnf
-bash: /etc/my.cnf: Permission denied
[root@VM_213_67_centos mysql]# ls
COPYING INSTALL-BINARY README bin data docs include lib man my-new.cnf my.cnf mysql-test scripts share sql-bench support-files
[root@VM_213_67_centos mysql]# cd bin
[root@VM_213_67_centos bin]# ls
innochecksum myisamlog mysql_config mysql_fix_extensions mysql_upgrade mysqladmin mysqld-debug mysqlhotcopy mysqltest_embedded
msql2mysql myisampack mysql_config_editor mysql_plugin mysql_waitpid mysqlbinlog mysqld_multi mysqlimport perror
my_print_defaults mysql mysql_convert_table_format mysql_secure_installation mysql_zap mysqlbug mysqld_safe mysqlshow replace
myisam_ftdump mysql_client_test mysql_embedded mysql_setpermission mysqlaccess mysqlcheck mysqldump mysqlslap resolve_stack_dump
myisamchk mysql_client_test_embedded mysql_find_rows mysql_tzinfo_to_sql mysqlaccess.conf mysqld mysqldumpslow mysqltest resolveip
[root@VM_213_67_centos bin]# cd -
/usr/local/mysql
[root@VM_213_67_centos mysql]# chown -R mysql
chown: missing operand after `mysql'
Try `chown --help' for more information.
[root@VM_213_67_centos mysql]# chgrp -R mysql
chgrp: missing operand after `mysql'
Try `chgrp --help' for more information.
[root@VM_213_67_centos mysql]# scripts/mysql_install_db --user=mysql
Installing MySQL system tables...2017-05-17 23:28:47 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2017-05-17 23:28:47 0 [Note] ./bin/mysqld (mysqld 5.6.26) starting as process 12879 ...
2017-05-17 23:28:47 12879 [Note] InnoDB: Using atomics to ref count buffer pool pages
2017-05-17 23:28:47 12879 [Note] InnoDB: The InnoDB memory heap is disabled
2017-05-17 23:28:47 12879 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2017-05-17 23:28:47 12879 [Note] InnoDB: Memory barrier is not used
2017-05-17 23:28:47 12879 [Note] InnoDB: Compressed tables use zlib 1.2.3
2017-05-17 23:28:47 12879 [Note] InnoDB: Using Linux native AIO
2017-05-17 23:28:47 12879 [Note] InnoDB: Using CPU crc32 instructions
2017-05-17 23:28:47 12879 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2017-05-17 23:28:47 12879 [Note] InnoDB: Completed initialization of buffer pool
2017-05-17 23:28:47 12879 [Note] InnoDB: The first specified data file ./ibdata1 did not exist: a new database to be created!
2017-05-17 23:28:47 12879 [Note] InnoDB: Setting file ./ibdata1 size to 12 MB
2017-05-17 23:28:47 12879 [Note] InnoDB: Database physically writes the file full: wait...
2017-05-17 23:28:47 12879 [Note] InnoDB: Setting log file ./ib_logfile101 size to 48 MB
2017-05-17 23:28:47 12879 [Note] InnoDB: Setting log file ./ib_logfile1 size to 48 MB
2017-05-17 23:28:48 12879 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0
2017-05-17 23:28:48 12879 [Warning] InnoDB: New log files created, LSN=45781
2017-05-17 23:28:48 12879 [Note] InnoDB: Doublewrite buffer not found: creating new
2017-05-17 23:28:48 12879 [Note] InnoDB: Doublewrite buffer created
2017-05-17 23:28:48 12879 [Note] InnoDB: 128 rollback segment(s) are active.
2017-05-17 23:28:48 12879 [Warning] InnoDB: Creating foreign key constraint system tables.
2017-05-17 23:28:48 12879 [Note] InnoDB: Foreign key constraint system tables created
2017-05-17 23:28:48 12879 [Note] InnoDB: Creating tablespace and datafile system tables.
2017-05-17 23:28:48 12879 [Note] InnoDB: Tablespace and datafile system tables created.
2017-05-17 23:28:48 12879 [Note] InnoDB: Waiting for purge to start
2017-05-17 23:28:48 12879 [Note] InnoDB: 5.6.26 started; log sequence number 0
2017-05-17 23:28:48 12879 [Note] Binlog end
2017-05-17 23:28:48 12879 [Note] InnoDB: FTS optimize thread exiting.
2017-05-17 23:28:48 12879 [Note] InnoDB: Starting shutdown...
2017-05-17 23:28:49 12879 [Note] InnoDB: Shutdown completed; log sequence number 1625977
OK

Filling help tables...2017-05-17 23:28:49 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2017-05-17 23:28:49 0 [Note] ./bin/mysqld (mysqld 5.6.26) starting as process 12901 ...
2017-05-17 23:28:49 12901 [Note] InnoDB: Using atomics to ref count buffer pool pages
2017-05-17 23:28:49 12901 [Note] InnoDB: The InnoDB memory heap is disabled
2017-05-17 23:28:49 12901 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2017-05-17 23:28:49 12901 [Note] InnoDB: Memory barrier is not used
2017-05-17 23:28:49 12901 [Note] InnoDB: Compressed tables use zlib 1.2.3
2017-05-17 23:28:49 12901 [Note] InnoDB: Using Linux native AIO
2017-05-17 23:28:49 12901 [Note] InnoDB: Using CPU crc32 instructions
2017-05-17 23:28:49 12901 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2017-05-17 23:28:49 12901 [Note] InnoDB: Completed initialization of buffer pool
2017-05-17 23:28:49 12901 [Note] InnoDB: Highest supported file format is Barracuda.
2017-05-17 23:28:49 12901 [Note] InnoDB: 128 rollback segment(s) are active.
2017-05-17 23:28:49 12901 [Note] InnoDB: Waiting for purge to start
2017-05-17 23:28:50 12901 [Note] InnoDB: 5.6.26 started; log sequence number 1625977
2017-05-17 23:28:50 12901 [Note] Binlog end
2017-05-17 23:28:50 12901 [Note] InnoDB: FTS optimize thread exiting.
2017-05-17 23:28:50 12901 [Note] InnoDB: Starting shutdown...
2017-05-17 23:28:51 12901 [Note] InnoDB: Shutdown completed; log sequence number 1625987
OK

To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:

./bin/mysqladmin -u root password 'new-password'
./bin/mysqladmin -u root -h VM_213_67_centos password 'new-password'

Alternatively you can run:

./bin/mysql_secure_installation

which will also give you the option of removing the test
databases and anonymous user created by default. This is
strongly recommended for production servers.

See the manual for more instructions.

You can start the MySQL daemon with:

cd . ; ./bin/mysqld_safe &

You can test the MySQL daemon with mysql-test-run.pl

cd mysql-test ; perl mysql-test-run.pl

Please report any problems at http://bugs.mysql.com/

The latest information about MySQL is available on the web at

http://www.mysql.com

Support MySQL by buying support/licenses at http://shop.mysql.com

WARNING: Found existing config file ./my.cnf on the system.
Because this file might be in use, it was not replaced,
but was used in bootstrap (unless you used --defaults-file)
and when you later start the server.
The new default config file was created as ./my-new.cnf,
please compare it with your file and take the changes you need.

WARNING: Default config file /etc/my.cnf exists on the system
This file will be read by default by the MySQL server
If you do not want to use this, either remove it, or use the
--defaults-file argument to mysqld_safe when starting the server

[root@VM_213_67_centos mysql]# scripts/mysql_install_db --user=mysql \
> --basedir=/opt/mysql/mysql \
> --datadir=/opt/mysql/mysql/data
FATAL ERROR: Could not find my-default.cnf

If you compiled from source, you need to run 'make install' to
copy the software into the correct location ready for operation.

If you are using a binary release, you must either be at the top
level of the extracted archive, or pass the --basedir option
pointing to that location.

[root@VM_213_67_centos mysql]# chown -R root
chown: missing operand after `root'
Try `chown --help' for more information.
[root@VM_213_67_centos mysql]# chown -R mysql data
[root@VM_213_67_centos mysql]# cp support-files/my-medium.cnf /etc/my.cnf
cp: cannot stat `support-files/my-medium.cnf': No such file or directory
[root@VM_213_67_centos mysql]# chkconfig --add mysqld
[root@VM_213_67_centos mysql]# chkconfig --list mysqld
mysqld 0:off1:off2:on3:on4:on5:on6:off
[root@VM_213_67_centos mysql]# netstat -anp|grep mysqld
[root@VM_213_67_centos mysql]# service mysqld start
Starting MySQL. SUCCESS!