系统环境:
操作系统:RedHat EL55
DB Soft: Mysql 5.6.4-m7
通过源码包安装mysql后,在启动mysqld时出现错误:
[root@rh55 mysql]# bin/mysqld_safe &
[1] 15846
[root@rh55 mysql]# 150610 17:04:36 mysqld_safe Logging to '/usr/local/mysql/data/mysql/rh55.err'.
150610 17:04:36 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data/mysql
150610 17:04:37 mysqld_safe mysqld from pid file /usr/local/mysql/data/mysql/rh55.pid ended
[1]+ Done bin/mysqld_safe
查看mysql日志:
[root@rh55 mysql]# more /usr/local/mysql/data/mysql/rh55.err
-
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
150610 16:56:59 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data/mysql/usr/local/mysql/bin/mysqld: Table 'mysql.plugin' doesn't exist150610 16:57:00 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.150610 16:57:00 InnoDB: The InnoDB memory heap is disabled150610 16:57:00 InnoDB: Mutexes and rw_locks use InnoDB's own implementation150610 16:57:00 InnoDB: Compressed tables use zlib 1.2.3150610 16:57:00 InnoDB: CPU does not support crc32 instructions150610 16:57:00 InnoDB: Initializing buffer pool, size = 128.0M150610 16:57:00 InnoDB: Completed initialization of buffer poolInnoDB: The first specified data file ./ibdata1 did not exist:InnoDB: a new database to be created!150610 16:57:00 InnoDB: Setting file ./ibdata1 size to 10 MBInnoDB: Database physically writes the file full: wait...150610 16:57:01 InnoDB: Log file ./ib_logfile0 did not exist: new to be createdInnoDB: Setting log file ./ib_logfile0 size to 5 MBInnoDB: Database physically writes the file full: wait...150610 16:57:02 InnoDB: Log file ./ib_logfile1 did not exist: new to be createdInnoDB: Setting log file ./ib_logfile1 size to 5 MBInnoDB: Database physically writes the file full: wait...InnoDB: Doublewrite buffer not found: creating newInnoDB: Doublewrite buffer created150610 16:57:04 InnoDB: 128 rollback segment(s) are active.InnoDB: Creating foreign key constraint system tablesInnoDB: Foreign key constraint system tables created150610 16:57:04 InnoDB: Waiting for the background threads to start150610 16:57:05 InnoDB: 1.2.4 started; log sequence number 0150610 16:57:05 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has beenstarted. Generating a new UUID: ab19e2d2-0f4e-11e5-b157-080027973e8a.150610 16:57:05 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't exist150610 16:57:05 mysqld_safe mysqld from pid file /usr/local/mysql/data/mysql/rh55.pid ended150610 17:04:36 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data/mysql/usr/local/mysql/bin/mysqld: Table 'mysql.plugin' doesn't exist150610 17:04:36 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.150610 17:04:36 InnoDB: The InnoDB memory heap is disabled150610 17:04:36 InnoDB: Mutexes and rw_locks use InnoDB's own implementation150610 17:04:36 InnoDB: Compressed tables use zlib 1.2.3150610 17:04:36 InnoDB: CPU does not support crc32 instructions150610 17:04:36 InnoDB: Initializing buffer pool, size = 128.0M150610 17:04:36 InnoDB: Completed initialization of buffer pool150610 17:04:36 InnoDB: highest supported file format is Barracuda.InnoDB: Log scan progressed past the checkpoint lsn 48961150610 17:04:36 InnoDB: Database was not shut down normally!InnoDB: Starting crash recovery.InnoDB: Reading tablespace information from the .ibd files...InnoDB: Restoring possible half-written data pages from the doublewriteInnoDB: buffer...InnoDB: Doing recovery: scanned up to log sequence number 1595695150610 17:04:36 InnoDB: Starting an apply batch of log records to the database...InnoDB: Progress in percents: 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 7677 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99InnoDB: Apply batch completed150610 17:04:37 InnoDB: 128 rollback segment(s) are active.150610 17:04:37 InnoDB: 1.2.4 started; log sequence number 1595695150610 17:04:37 [Note] Recovering after a crash using mysql-bin150610 17:04:37 [Note] Starting crash recovery...150610 17:04:37 [Note] Crash recovery finished.150610 17:04:37 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't exist150610 17:04:37 mysqld_safe mysqld from pid file /usr/local/mysql/data/mysql/rh55.pid ended
查看mysql配置文件:
[root@rh55 ~]# cat /etc/my.cnf
|
1
2
3
4
5
6
7
8
9
10
11
12
13
|
[mysqld]
port =
3306
socket = /tmp/mysql.sock
skip-external-locking
key_buffer_size = 16M
max_allowed_packet = 1M
table_open_cache =
64
sort_buffer_size = 512K
net_buffer_length = 8K
read_buffer_size = 256K
read_rnd_buffer_size = 512K
myisam_sort_buffer_size = 8M
datadir=/usr/local/mysql/data/mysql
|
解决方案:
[root@rh55 mysql]# scripts/mysql_install_db --user=mysql --datadir=/usr/local/mysql/data/mysql
-
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
WARNING: The host'rh55'could not be looked up with resolveip.This probably means that your libc libraries are not100% compatiblewiththisbinary MySQL version. The MySQL daemon, mysqld, should worknormally with the exception that host name resolving will not work.This means that you should use IP addresses instead of hostnameswhen specifying MySQL privileges !Installing MySQL system tables...15061017:07:10InnoDB: The InnoDB memory heap is disabled15061017:07:10InnoDB: Mutexes and rw_locks use InnoDB's own implementation15061017:07:10InnoDB: Compressed tables use zlib1.2.315061017:07:10InnoDB: CPU does not support crc32 instructions15061017:07:10InnoDB: Initializing buffer pool, size =128.0M15061017:07:10InnoDB: Completed initialization of buffer pool15061017:07:10InnoDB: highest supported file format is Barracuda.InnoDB: Log scan progressed past the checkpoint lsn4896115061017:07:10InnoDB: Database was not shut down normally!InnoDB: Starting crash recovery.InnoDB: Reading tablespace information from the .ibd files...InnoDB: Restoring possible half-written data pages from the doublewriteInnoDB: buffer...InnoDB: Doing recovery: scanned up to log sequence number159569515061017:07:11InnoDB: Starting an apply batch of log records to the database...InnoDB: Progress in percents:45464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899InnoDB: Apply batch completed15061017:07:11InnoDB:128rollback segment(s) are active.15061017:07:11InnoDB: Waitingforthe background threads to start15061017:07:12InnoDB:1.2.4started; log sequence number159569515061017:07:12[Note] Recovering after a crash using mysql-bin15061017:07:12[Note] Starting crash recovery...15061017:07:12[Note] Crash recovery finished.15061017:07:14[Warning] Info table is not ready to be used. Table'mysql.slave_master_info'cannot be opened.15061017:07:14[Warning] Errorwhilechecking replication metadata. Setting the requested repository in order to give users the chance to fix the problem and restart the server. Ifthisis a live upgrade please consider using mysql_upgrade to fix the problem.15061017:07:14[Warning] Info table is not ready to be used. Table'mysql.slave_relay_log_info'cannot be opened.15061017:07:14[Warning] Errorwhilechecking replication metadata. Setting the requested repository in order to give users the chance to fix the problem and restart the server. Ifthisis a live upgrade please consider using mysql_upgrade to fix the problem.15061017:07:15[Note] Binlog end15061017:07:15[Note] Shutting down plugin'partition'15061017:07:15[Note] Shutting down plugin'INNODB_SYS_FOREIGN_COLS'15061017:07:15[Note] Shutting down plugin'INNODB_SYS_FOREIGN'15061017:07:15[Note] Shutting down plugin'INNODB_SYS_FIELDS'15061017:07:15[Note] Shutting down plugin'INNODB_SYS_COLUMNS'15061017:07:15[Note] Shutting down plugin'INNODB_SYS_INDEXES'15061017:07:15[Note] Shutting down plugin'INNODB_SYS_TABLESTATS'15061017:07:15[Note] Shutting down plugin'INNODB_SYS_TABLES'15061017:07:15[Note] Shutting down plugin'INNODB_FT_INDEX_TABLE'15061017:07:15[Note] Shutting down plugin'INNODB_FT_INDEX_CACHE'15061017:07:15[Note] Shutting down plugin'INNODB_FT_CONFIG'15061017:07:15[Note] Shutting down plugin'INNODB_FT_BEING_DELETED'15061017:07:15[Note] Shutting down plugin'INNODB_FT_DELETED'15061017:07:15[Note] Shutting down plugin'INNODB_FT_INSERTED'15061017:07:15[Note] Shutting down plugin'INNODB_FT_DEFAULT_STOPWORD'15061017:07:15[Note] Shutting down plugin'INNODB_METRICS'15061017:07:15[Note] Shutting down plugin'INNODB_BUFFER_POOL_STATS'15061017:07:15[Note] Shutting down plugin'INNODB_BUFFER_PAGE_LRU'15061017:07:15[Note] Shutting down plugin'INNODB_BUFFER_PAGE'15061017:07:15[Note] Shutting down plugin'INNODB_CMPMEM_RESET'15061017:07:15[Note] Shutting down plugin'INNODB_CMPMEM'15061017:07:15[Note] Shutting down plugin'INNODB_CMP_RESET'15061017:07:15[Note] Shutting down plugin'INNODB_CMP'15061017:07:15[Note] Shutting down plugin'INNODB_LOCK_WAITS'15061017:07:15[Note] Shutting down plugin'INNODB_LOCKS'15061017:07:15[Note] Shutting down plugin'INNODB_TRX'15061017:07:15[Note] Shutting down plugin'InnoDB'15061017:07:15InnoDB: FTS optimize thread exiting.15061017:07:15InnoDB: Starting shutdown...15061017:07:16InnoDB: Shutdown completed; log sequence number160285115061017:07:16[Note] Shutting down plugin'PERFORMANCE_SCHEMA'15061017:07:16[Note] Shutting down plugin'CSV'15061017:07:16[Note] Shutting down plugin'MRG_MYISAM'15061017:07:16[Note] Shutting down plugin'MEMORY'15061017:07:16[Note] Shutting down plugin'MyISAM'15061017:07:16[Note] Shutting down plugin'mysql_old_password'15061017:07:16[Note] Shutting down plugin'mysql_native_password'15061017:07:16[Note] Shutting down plugin'binlog'OKFilling help tables...15061017:07:16InnoDB: The InnoDB memory heap is disabled15061017:07:16InnoDB: Mutexes and rw_locks use InnoDB's own implementation15061017:07:16InnoDB: Compressed tables use zlib1.2.315061017:07:16InnoDB: CPU does not support crc32 instructions15061017:07:16InnoDB: Initializing buffer pool, size =128.0M15061017:07:16InnoDB: Completed initialization of buffer pool15061017:07:16InnoDB: highest supported file format is Barracuda.15061017:07:17InnoDB:128rollback segment(s) are active.15061017:07:17InnoDB:1.2.4started; log sequence number160285115061017:07:17[Note] Binlog end15061017:07:17[Note] Shutting down plugin'partition'15061017:07:17[Note] Shutting down plugin'INNODB_SYS_FOREIGN_COLS'15061017:07:17[Note] Shutting down plugin'INNODB_SYS_FOREIGN'15061017:07:17[Note] Shutting down plugin'INNODB_SYS_FIELDS'15061017:07:17[Note] Shutting down plugin'INNODB_SYS_COLUMNS'15061017:07:17[Note] Shutting down plugin'INNODB_SYS_INDEXES'15061017:07:17[Note] Shutting down plugin'INNODB_SYS_TABLESTATS'15061017:07:17[Note] Shutting down plugin'INNODB_SYS_TABLES'15061017:07:17[Note] Shutting down plugin'INNODB_FT_INDEX_TABLE'15061017:07:17[Note] Shutting down plugin'INNODB_FT_INDEX_CACHE'15061017:07:17[Note] Shutting down plugin'INNODB_FT_CONFIG'15061017:07:17[Note] Shutting down plugin'INNODB_FT_BEING_DELETED'15061017:07:17[Note] Shutting down plugin'INNODB_FT_DELETED'15061017:07:17[Note] Shutting down plugin'INNODB_FT_INSERTED'15061017:07:17[Note] Shutting down plugin'INNODB_FT_DEFAULT_STOPWORD'15061017:07:17[Note] Shutting down plugin'INNODB_METRICS'15061017:07:17[Note] Shutting down plugin'INNODB_BUFFER_POOL_STATS'15061017:07:17[Note] Shutting down plugin'INNODB_BUFFER_PAGE_LRU'15061017:07:17[Note] Shutting down plugin'INNODB_BUFFER_PAGE'15061017:07:17[Note] Shutting down plugin'INNODB_CMPMEM_RESET'15061017:07:17[Note] Shutting down plugin'INNODB_CMPMEM'15061017:07:17[Note] Shutting down plugin'INNODB_CMP_RESET'15061017:07:17[Note] Shutting down plugin'INNODB_CMP'15061017:07:17[Note] Shutting down plugin'INNODB_LOCK_WAITS'15061017:07:17[Note] Shutting down plugin'INNODB_LOCKS'15061017:07:17[Note] Shutting down plugin'INNODB_TRX'15061017:07:17[Note] Shutting down plugin'InnoDB'15061017:07:17InnoDB: FTS optimize thread exiting.15061017:07:17InnoDB: Starting shutdown...15061017:07:18InnoDB: Shutdown completed; log sequence number160286115061017:07:18[Note] Shutting down plugin'PERFORMANCE_SCHEMA'15061017:07:18[Note] Shutting down plugin'CSV'15061017:07:18[Note] Shutting down plugin'MRG_MYISAM'15061017:07:18[Note] Shutting down plugin'MEMORY'15061017:07:18[Note] Shutting down plugin'MyISAM'15061017:07:18[Note] Shutting down plugin'mysql_old_password'15061017:07:18[Note] Shutting down plugin'mysql_native_password'15061017:07:18[Note] Shutting down plugin'binlog'OKTo start mysqld at boot time you have to copysupport-files/mysql.server to the right placeforyour systemPLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !Todoso, start the server, then issue the following commands:./bin/mysqladmin -u root password'new-password'./bin/mysqladmin -u root -h rh55 password'new-password'Alternatively you can run:./bin/mysql_secure_installationwhich will also give you the option of removing the testdatabases and anonymous user created bydefault. This isstrongly recommendedforproduction servers.See the manualformore instructions.You can start the MySQL daemon with:cd . ; ./bin/mysqld_safe &You can test the MySQL daemon with mysql-test-run.plcd ./mysql-test ; perl mysql-test-run.plPlease report any problems with the ./bin/mysqlbug script!
启动mysql server:
[root@rh55 mysql]# bin/mysqld_safe &
[1] 16199
[root@rh55 mysql]# 150610 17:08:22 mysqld_safe Logging to '/usr/local/mysql/data/mysql/rh55.err'.
150610 17:08:22 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data/mysql
验证启动成功:
[root@rh55 mysql]# netstat -an |grep 3306
tcp 0 0 :::3306 :::* LISTEN