在启动mysql时报下列错误
[root@mysqld2 ~]# service mysql.server start
Starting MySQL......................................The server quit without updating PID file (/var/lib/mysql/mysqld2.clvn.com.cn.pid). [失败]
解决方法
查看日志文件
[root@mysqld1 mysql]# tail /var/log/mysqld.log
2014-05-09 22:08:10 3483 [Note] NDB: Changed global value of binlog_format from STATEMENT to MIXED
2014-05-09 22:08:46 3483 [Warning] NDB: server id set to zero - changes logged to bin log with server id zero will be logged with another server id by slave mysqlds
2014-05-09 22:08:46 3483 [Note] Starting Cluster Binlog Thread
2014-05-09 22:08:46 3483 [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: 6f59371c-d783-11e3-ac36-000c2971b28f.
2014-05-09 22:08:46 3483 [Note] Server hostname (bind-address): '*'; port: 3306
2014-05-09 22:08:46 3483 [Note] IPv6 is available.
2014-05-09 22:08:46 3483 [Note] - '::' resolves to '::';
2014-05-09 22:08:46 3483 [Note] Server socket created on IP: '::'.
2014-05-09 22:08:46 3483 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.user' doesn't exist
140509 22:08:46 mysqld_safe mysqld from pid file /var/lib/mysql/mysqld1.clvn.com.cn.pid ended
解决方法
[root@mysqld1 mysql]# scripts/mysql_install_db --user=mysql
Installing MySQL system tables...2014-05-09 22:51:12 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2014-05-09 22:51:12 3564 [Note] InnoDB: Using atomics to ref count buffer pool pages
2014-05-09 22:51:12 3564 [Note] InnoDB: The InnoDB memory heap is disabled
2014-05-09 22:51:12 3564 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2014-05-09 22:51:12 3564 [Note] InnoDB: Compressed tables use zlib 1.2.3
2014-05-09 22:51:12 3564 [Note] InnoDB: Using Linux native AIO
2014-05-09 22:51:12 3564 [Note] InnoDB: Using CPU crc32 instructions
2014-05-09 22:51:12 3564 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2014-05-09 22:51:12 3564 [Note] InnoDB: Completed initialization of buffer pool
2014-05-09 22:51:12 3564 [Note] InnoDB: Highest supported file format is Barracuda.
2014-05-09 22:51:12 3564 [Note] InnoDB: 128 rollback segment(s) are active.
2014-05-09 22:51:12 3564 [Note] InnoDB: Waiting for purge to start
2014-05-09 22:51:13 3564 [Note] InnoDB: 5.6.17 started; log sequence number 1626007
2014-05-09 22:51:13 3564 [Note] Binlog end
2014-05-09 22:51:13 3564 [Note] InnoDB: FTS optimize thread exiting.
2014-05-09 22:51:13 3564 [Note] InnoDB: Starting shutdown...
2014-05-09 22:51:14 3564 [Note] InnoDB: Shutdown completed; log sequence number 1626017
OK
Filling help tables...2014-05-09 22:51:14 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2014-05-09 22:51:14 3588 [Note] InnoDB: Using atomics to ref count buffer pool pages
2014-05-09 22:51:14 3588 [Note] InnoDB: The InnoDB memory heap is disabled
2014-05-09 22:51:14 3588 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2014-05-09 22:51:14 3588 [Note] InnoDB: Compressed tables use zlib 1.2.3
2014-05-09 22:51:14 3588 [Note] InnoDB: Using Linux native AIO
2014-05-09 22:51:14 3588 [Note] InnoDB: Using CPU crc32 instructions
2014-05-09 22:51:14 3588 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2014-05-09 22:51:14 3588 [Note] InnoDB: Completed initialization of buffer pool
2014-05-09 22:51:14 3588 [Note] InnoDB: Highest supported file format is Barracuda.
2014-05-09 22:51:14 3588 [Note] InnoDB: 128 rollback segment(s) are active.
2014-05-09 22:51:15 3588 [Note] InnoDB: Waiting for purge to start
2014-05-09 22:51:15 3588 [Note] InnoDB: 5.6.17 started; log sequence number 1626017
2014-05-09 22:51:15 3588 [Note] Binlog end
2014-05-09 22:51:15 3588 [Note] InnoDB: FTS optimize thread exiting.
2014-05-09 22:51:15 3588 [Note] InnoDB: Starting shutdown...
2014-05-09 22:51:16 3588 [Note] InnoDB: Shutdown completed; log sequence number 1626027
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 mysqld1.clvn.com.cn 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
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.
[root@mysqld1 mysql]# ./bin/mysqld_safe &
[1] 3612
[root@mysqld1 mysql]# 140509 22:51:29 mysqld_safe Logging to '/usr/local/mysql/data/mysqld1.clvn.com.cn.err'.
140509 22:51:29 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data
查看mysql.server的状态信息
[root@mysqld1 ~]# service mysql.server start
Starting MySQL. [确定]
问题解决