日期:2014-05-16 浏览次数:20814 次
注意:颜色标注的地方
#! /bin/sh
mkdir -p /var/lib/mysql
mkdir -p /var/lib/data/mysql # 这里创建了mysql的数据目录
./scripts/mysql_install_db --user=mysql --basedir=/var/lib/mysql --datadir=/var/lib/data/mysql --defaults-file=/etc/my.cnf # 通过参数 --datadir=/var/lib/data/mysql 来初始化数据库是不能够成功启动数据库的
# 错误:/var/lib/mysql/sbin/mysqld: File './mysql-bin.index' not found 目录权限不够# 错误日志:
121212 19:20:26 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql/data
/var/lib/mysql/sbin/mysqld: Table 'mysql.plugin' doesn't exist
121212 19:20:26 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
121212 19:20:26 InnoDB: The InnoDB memory heap is disabled
121212 19:20:26 InnoDB: Mutexes and rw_locks use InnoDB's own implementation
121212 19:20:26 InnoDB: Compressed tables use zlib 1.2.3
121212 19:20:26 InnoDB: Initializing buffer pool, size = 128.0M
121212 19:20:26 InnoDB: Completed initialization of buffer pool
121212 19:20:26 InnoDB: highest supported file format is Barracuda.
121212 19:20:26 InnoDB: Waiting for the background threads to start
121212 19:20:27 InnoDB: 1.1.8 started; log sequence number 1595675
121212 19:20:27 [Note] Recovering after a crash using mysql-bin
121212 19:20:27 [Note] Starting crash recovery...
121212 19:20:27 [Note] Crash recovery finished.
121212 19:20:27 [Note] Server hostname (bind-address): '0.0.0.0'; port: 3306
121212 19:20:27 [Note] - '0.0.0.0' resolves to '0.0.0.0';
121212 19:20:27 [Note] Server socket created on IP: '0.0.0.0'.
121212 19:20:27 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't exist
121212 19:20:27 mysqld_safe mysqld from pid file /var/lib/mysql/data/localhost.localdomain.pid ended