2016-02-16 42 views
0

我有一個新的MySQL服務器安裝(通過yum安裝)將無法啓動MySQL不會在Linux上啓動

bash-4.1# /sbin/service mysqld start 
MySQL Daemon failed to start. 
Starting mysqld:           [FAILED] 

的/etc/my.cnf中已被設置爲默認值:

# For advice on how to change settings please see 
# http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html 

[mysqld] 
# 
# Remove leading # and set to the amount of RAM for the most important data 
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%. 
# innodb_buffer_pool_size = 128M 
# 
# Remove leading # to turn on a very important data integrity option: logging 
# changes to the binary log between backups. 
# log_bin 
# 
# Remove leading # to set options mainly useful for reporting servers. 
# The server defaults are faster for transactions and fast SELECTs. 
# Adjust sizes as needed, experiment to find the optimal values. 
# join_buffer_size = 128M 
# sort_buffer_size = 2M 
# read_rnd_buffer_size = 2M 
datadir=/var/lib/mysql 
socket=/var/lib/mysql/mysql.sock 

# Disabling symbolic-links is recommended to prevent assorted security risks 
symbolic-links=0 

log-error=/var/log/mysqld.log 
pid-file=/var/run/mysqld/mysqld.pid 

我收到的錯誤是:

2016-02-16T22:47:18.453320Z mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql 
2016-02-16T22:47:18.888497Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details). 
2016-02-16T22:47:18.889955Z 0 [Note] /usr/sbin/mysqld (mysqld 5.7.11) starting as process 4321 ... 
2016-02-16T22:47:19.016515Z 0 [Note] InnoDB: PUNCH HOLE support available 
2016-02-16T22:47:19.016568Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins 
2016-02-16T22:47:19.016583Z 0 [Note] InnoDB: Uses event mutexes 
2016-02-16T22:47:19.016596Z 0 [Note] InnoDB: GCC builtin __sync_synchronize() is used for memory barrier 
2016-02-16T22:47:19.016609Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.3 
2016-02-16T22:47:19.016631Z 0 [Note] InnoDB: Using Linux native AIO 
2016-02-16T22:47:19.018127Z 0 [Note] InnoDB: Number of pools: 1 
2016-02-16T22:47:19.018819Z 0 [Note] InnoDB: Using CPU crc32 instructions 
2016-02-16T22:47:19.052517Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M 
2016-02-16T22:47:19.071855Z 0 [Note] InnoDB: Completed initialization of buffer pool 
2016-02-16T22:47:19.078235Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority(). 
2016-02-16T22:47:19.092945Z 0 [Note] InnoDB: Highest supported file format is Barracuda. 
2016-02-16T22:47:19.107542Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables 
2016-02-16T22:47:19.107588Z 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ... 
2016-02-16T22:47:19.160738Z 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB. 
2016-02-16T22:47:19.163712Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active. 
2016-02-16T22:47:19.163748Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active. 
2016-02-16T22:47:19.165210Z 0 [Note] InnoDB: Waiting for purge to start 
2016-02-16T22:47:19.215586Z 0 [Note] InnoDB: 5.7.11 started; log sequence number 1210437 
2016-02-16T22:47:19.216328Z 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool 
2016-02-16T22:47:19.217459Z 0 [Note] Plugin 'FEDERATED' is disabled. 
2016-02-16T22:47:19.217537Z 0 [Note] InnoDB: Buffer pool(s) load completed at 160216 22:47:19 
mysqld: Table 'mysql.plugin' doesn't exist 
2016-02-16T22:47:19.217905Z 0 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it. 
2016-02-16T22:47:19.219399Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened. 
2016-02-16T22:47:19.219650Z 0 [Warning] Failed to set up SSL because of the following SSL library error: SSL context is not usable without certificate and private key 
2016-02-16T22:47:19.220055Z 0 [Note] Server hostname (bind-address): '*'; port: 3306 
2016-02-16T22:47:19.220231Z 0 [Note] IPv6 is available. 
2016-02-16T22:47:19.220261Z 0 [Note] - '::' resolves to '::'; 
2016-02-16T22:47:19.220280Z 0 [Note] Server socket created on IP: '::'. 
2016-02-16T22:47:19.233206Z 0 [Warning] Failed to open optimizer cost constant tables 

2016-02-16T22:47:19.233439Z 0 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.user' doesn't exist 
2016-02-16T22:47:19.233551Z 0 [ERROR] Aborting 

然而,由於mysqld的不運行我不能運行mysql_upgrade。其他網站聲明數據文件的文件權限可能是一個問題,但它們全都屬於mysql(即我認爲正確)。我也嘗試過運行mysqld_safe,但沒有成功。

有人可以建議我做了什麼錯嗎?

+0

都只有不到由'mysql'用戶擁有的'在/ var/lib中/ mysql'的文件嗎?你的文件系統是否已滿? –

+1

似乎是MySQL的安裝不正確。你可以嘗試卸載並重新安裝或嘗試運行mysql_install_db --user = mysql --basedir =/usr/--ldata =/var/lib/mysql /作爲根 – mark

+0

是的,/ var/lib/mysql下的所有東西都有所有權mysql:mysql,並且文件系統的每個分區上都有空格 –

回答

2

謝謝馬克。 mysql_install_db不起作用(已棄用,然後建議初始化失敗)。但是,徹底清理並重新安裝可解決問題。 作爲參考,我執行的具體步驟爲:

yum remove mysql 
rm -fr /usr/bin/mysql 
rm -fr /var/lib/mysql 
rm -fr /etc/my* 
(reboot) 
yum install mysql-community-{server,client,common,libs}-* 
/sbin/service mysqld start