简体   繁体   中英

MySQL won't start on Linux

I have a fresh mysql-server install (installed via yum) that will not start

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

The /etc/my.cnf has been set to default:

# 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

The error I receive is:

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

However, I can't run mysql_upgrade as mysqld isn't running. Other sites have stated that file permissions of the data files could be an issue, but they are all owned by mysql (ie I believe correct). I've also tried running mysqld_safe, but without success.

Can someone please suggest what I've done wrong?

Thanks Mark. mysql_install_db didn't work (was deprecated, and then the suggested initialise failed). However, a complete clean and reinstall resolved the issue. For reference, the exact steps I performed were:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM