MySQL学习笔记2-System administration(STOP or START MySQL)

来源:互联网 发布:全国高校网络教育 编辑:程序博客网 时间:2024/06/05 06:45

START MYSQL

[root@localhost bin]# service mysql start

Starting MySQL.. SUCCESS! 
[root@localhost bin]# ps -ef | grep mysql
root      5548     1  0 22:00 pts/2    00:00:00 /bin/sh /usr/bin/mysqld_safe --datadir=/var/lib/mysql --pid-file=/var/lib/mysql/localhost.localdomain.pid
mysql     5651  5548  7 22:00 pts/2    00:00:01 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib/mysql/plugin --user=mysql --log-error=/var/lib/mysql/localhost.localdomain.err --pid-file=/var/lib/mysql/localhost.localdomain.pid
root      5692  3327  0 22:01 pts/2    00:00:00 grep mysql
[root@localhost bin]# cat /var/lib/mysql/localhost.localdomain.err
151117 22:00:53 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
2015-11-17 22:00:54 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2015-11-17 22:00:54 0 [Note] /usr/sbin/mysqld (mysqld 5.6.27) starting as process 5651 ...
2015-11-17 22:00:54 5651 [Note] Plugin 'FEDERATED' is disabled.
2015-11-17 22:00:54 5651 [Note] InnoDB: Using atomics to ref count buffer pool pages
2015-11-17 22:00:54 5651 [Note] InnoDB: The InnoDB memory heap is disabled
2015-11-17 22:00:54 5651 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2015-11-17 22:00:54 5651 [Note] InnoDB: Memory barrier is not used
2015-11-17 22:00:54 5651 [Note] InnoDB: Compressed tables use zlib 1.2.3
2015-11-17 22:00:54 5651 [Note] InnoDB: Using Linux native AIO
2015-11-17 22:00:54 5651 [Note] InnoDB: Not using CPU crc32 instructions
2015-11-17 22:00:54 5651 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2015-11-17 22:00:54 5651 [Note] InnoDB: Completed initialization of buffer pool
2015-11-17 22:00:54 5651 [Note] InnoDB: Highest supported file format is Barracuda.
2015-11-17 22:00:54 5651 [Note] InnoDB: 128 rollback segment(s) are active.
2015-11-17 22:00:54 5651 [Note] InnoDB: Waiting for purge to start
2015-11-17 22:00:54 5651 [Note] InnoDB: 5.6.27 started; log sequence number 1625987
2015-11-17 22:00:54 5651 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 9e7e6458-8d33-11e5-a647-000c29ac69e3.
2015-11-17 22:00:54 5651 [Note] Server hostname (bind-address): '*'; port: 3306
2015-11-17 22:00:54 5651 [Note] IPv6 is available.
2015-11-17 22:00:54 5651 [Note]   - '::' resolves to '::';
2015-11-17 22:00:54 5651 [Note] Server socket created on IP: '::'.
2015-11-17 22:00:54 5651 [Note] Event Scheduler: Loaded 0 events
2015-11-17 22:00:54 5651 [Note] /usr/sbin/mysqld: ready for connections.
Version: '5.6.27'  socket: '/var/lib/mysql/mysql.sock'  port: 3306  MySQL Community Server (GPL)
[root@localhost bin]# cat /var/lib/mysql/localhost.localdomain.pid
5651
[root@localhost bin]# ls -ltr /var/lib/mysql
总用量 110624
drwxr-xr-x. 2 mysql mysql     4096 11月 17 21:33 test
-rw-rw----. 1 mysql mysql 50331648 11月 17 21:33 ib_logfile1
drwx------. 2 mysql mysql     4096 11月 17 21:33 performance_schema
drwx--x--x. 2 mysql mysql     4096 11月 17 21:33 mysql
-rw-r--r--. 1 mysql mysql      125 11月 17 21:33 RPM_UPGRADE_MARKER-LAST
-rw-r--r--. 1 root  root       125 11月 17 21:33 RPM_UPGRADE_HISTORY
-rw-rw----. 1 mysql mysql       56 11月 17 22:00 auto.cnf
srwxrwxrwx. 1 mysql mysql        0 11月 17 22:00 mysql.sock
-rw-rw----. 1 mysql mysql        5 11月 17 22:00 localhost.localdomain.pid
-rw-r-----. 1 mysql root      2112 11月 17 22:00 localhost.localdomain.err
-rw-rw----. 1 mysql mysql 12582912 11月 17 22:00 ibdata1
-rw-rw----. 1 mysql mysql 50331648 11月 17 22:00 ib_logfile0

[root@localhost bin]# 


STOP MYSQL


<<<<

mysqld_safe has no server shutdown capability. You can use mysqladmin shutdown instead. Note that if you forcibly terminate mysqld by using the kill -9 command to send it a signal, then mysqld_safe detects that mysqld terminated abnormally and restarts it. You can work around this by killing mysqld_safe first and then killing mysqld, but it is better to use mysqladmin shutdown, which initiates a normal (clean) server shutdown.

<<<<

[root@localhost bin]# service mysql stop
Shutting down MySQL.. SUCCESS! 
[root@localhost bin]# 

<<< or

[root@localhost ~]# mysqladmin shutdown
mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'root'@'localhost' (using password: NO)'
[root@localhost ~]# mysqladmin -uroot -pmysql shutdown
Warning: Using a password on the command line interface can be insecure.
[root@localhost ~]# ps -ef | grep mysql
root      6112  6073  0 23:46 pts/4    00:00:00 grep mysql
[root@localhost ~]# 



0 0