欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  数据库

MySQL启动故障处理一例(errno 13)

程序员文章站 2022-05-30 19:17:00
...

之前在系统上装了个MySQL用于测试,今天发现启动mysqld_safe进程的时候报错,如下所示: [root@bak local]# mysqld_safe [1] 2

[root@bak mysql]# ./scripts/mysql_install_db

Installing MySQL system tables...

141017 9:28:24 [Warning] options --log-slow-admin-statements, --log-queries-not-using-indexes and --log-slow-slave-statements have no effect if --log_slow_queries is not set

OK

Filling help tables...

141017 9:28:25 [Warning] options --log-slow-admin-statements, --log-queries-not-using-indexes and --log-slow-slave-statements have no effect if --log_slow_queries is not set

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:

/usr/local/mysql/bin/mysqladmin -u root password 'new-password'

/usr/local/mysql/bin/mysqladmin -u root -h bak password 'new-password'

Alternatively you can run:

/usr/local/mysql/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 /usr/local/mysql ; /usr/local/mysql/bin/mysqld_safe &

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

cd /usr/local/mysql/mysql-test ; perl mysql-test-run.pl

Please report any problems at

[root@bak mysql]# mysqld_safe &

[1] 2858

[root@bak mysql]# Starting mysqld daemon with databases from /data/mysql/mysql_3306/data

[root@bak mysql]# mysqSTOPPING server from pid file /data/mysql/mysql_3306/data/bak.pid

l141017 09:28:36 mysqld ended

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

[1]+ Done mysqld_safe

初始化时成功的,可以看到有2个OK,不过启动依然报错,再次查看error.log

[root@bak mysql]# cat /data/mysql/mysql_3306/data/error.log

141017 9:24:53 [Warning] Using unique option prefix myisam_recover instead of myisam-recover-options is deprecated and will be removed in a future release. Please use the full name instead.

141017 9:24:53 [Note] Plugin 'FEDERATED' is disabled.

/usr/libexec/mysqld: Table 'mysql.plugin' doesn't exist

141017 9:24:53 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.

141017 9:24:53 InnoDB: The InnoDB memory heap is disabled

141017 9:24:53 InnoDB: Mutexes and rw_locks use InnoDB's own implementation

141017 9:24:53 InnoDB: Compressed tables use zlib 1.2.3

141017 9:24:53 InnoDB: Using Linux native AIO

141017 9:24:53 InnoDB: Initializing buffer pool, size = 128.0M

141017 9:24:53 InnoDB: Completed initialization of buffer pool

InnoDB: The first specified data file ./ibdata1 did not exist:

InnoDB: a new database to be created!

141017 9:24:53 InnoDB: Setting file ./ibdata1 size to 100 MB

InnoDB: Database physically writes the file full: wait...

InnoDB: Progress in MB: 100

141017 9:24:58 InnoDB: Log file ./ib_logfile0 did not exist: new to be created

InnoDB: Setting log file ./ib_logfile0 size to 100 MB

InnoDB: Database physically writes the file full: wait...

InnoDB: Progress in MB: 100

141017 9:25:03 InnoDB: Log file ./ib_logfile1 did not exist: new to be created

InnoDB: Setting log file ./ib_logfile1 size to 100 MB

InnoDB: Database physically writes the file full: wait...

InnoDB: Progress in MB: 100

141017 9:25:08 InnoDB: Log file ./ib_logfile2 did not exist: new to be created

InnoDB: Setting log file ./ib_logfile2 size to 100 MB

InnoDB: Database physically writes the file full: wait...

InnoDB: Progress in MB: 100

InnoDB: Doublewrite buffer not found: creating new

InnoDB: Doublewrite buffer created

InnoDB: 127 rollback segment(s) active.

InnoDB: Creating foreign key constraint system tables

InnoDB: Foreign key constraint system tables created

141017 9:25:13 InnoDB: Waiting for the background threads to start

141017 9:25:14 InnoDB: 5.5.39 started; log sequence number 0

141017 9:25:14 [Note] Server hostname (bind-address): '0.0.0.0'; port: 3306

141017 9:25:14 [Note] - '0.0.0.0' resolves to '0.0.0.0';

141017 9:25:14 [Note] Server socket created on IP: '0.0.0.0'.

141017 9:25:14 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't exist