MySQL startup times wrong: starting MySQL ... error! The server quit without updating PID file (/opt/mysql/data/mysql.pid) Workaround:
First look at the configuration of my MySQL configuration file:
Cat/usr/local/mysql/my.cnf
[Mysqld]
Basedir =/usr/local/mysql
DataDir =/opt/mysql/data
Port = 3306
server_id = 1
Pid-file =/opt/mysql/data/mysql.pid
Socket =/tmp/mysqld.sock
Default_storage_engine = InnoDB
Log-bin =/opt/mysql/binlog/mysql-binlog
Expire_logs_days = 14
Max_binlog_size = 5G
Binlog_cache_size = 10M
Max_binlog_cache_size = 20M
Slow_query_log
Long_query_time = 2
Slow_query_log_file =/opt/mysql/data/slow.log
Open_files_limit = 65535
InnoDB = Force
innodb_buffer_pool_size = 100M
Innodb_log_file_size = 1G
Query_cache_size = 0
Thread_cache_size = 64
Table_definition_cache = 512
Table_open_cache = 512
Max_connections = 20
Sort_buffer_size = 10M
Max_allowed_packet = 6M
Sql_mode=no_engine_substitution,strict_trans_tables
[Client]
#socket =/var/lib/mysql/mysql.sock
1, may be the/opt/mysql/data/mysql.pid file does not have the permission to write
Workaround: Give permission, execute "chown-r mysql.mysql/opt/mysql/data" "Chmod-r 755/opt/mysql/data" and restart Mysqld
2. The MySQL process may already exist in the process
WORKAROUND: Use the command "Ps-ef|grep mysqld" to see if there is a mysqld process, kill with "kill-9 process number" and then restart mysqld!
3, may be the second time to install MySQL on the machine, there are residual data affect the start of the service.
Workaround: Go to the MySQL binary log directory to see if there is a mysql-binlog.index, and quickly delete it.
4. mysql will use the/ETC/MY.CNF configuration file when it is not specified at startup, please open this file to see if there is a specified data directory (DATADIR) under [mysqld].
WORKAROUND: Please set this line under [mysqld]: DataDir =/opt/mysql/data
5. skip-federated field Problem
Workaround: Check the/etc/my.cnf file for any skip-federated fields that have not been commented out, and if so, comment them out immediately.
6. Error log directory does not exist
Workaround: Use "Chown" "chmod" command to give MySQL owner and permissions
7, the disaster of SELinux, if it is a CentOS system, default will open SELinux
Workaround: Temporarily change to warning mode first: [[email protected] php]# Setenforce 0
Then open the/etc/sysconfig/selinux and change the selinux=enforcing to selinux=disabled
Additional:
Experience:
One more reason may be:
Check the configuration file/usr/local/mysql/my.cnf there is no innodb_buffer_pool_size this parameter
innodb_buffer_pool_size: The main role is to cache the index of the InnoDB table, data, buffer when inserting data;
Default value: 128M;
Dedicated MySQL server sets the size of this value: System memory is 70%-80% best.
If your system has little memory, look at this parameter and set it to a smaller value.
After successful startup:
[Email protected] log]# Ps-ef | grep MySQL
Root 11842 1 0 07:54 pts/1 00:00:00/bin/sh/usr/local/mysql/bin/mysqld_safe--datadir=/opt/mysql/data--pid-f Ile=/opt/mysql/data/mysql.pid
MySQL 12336 11842 0 07:54 pts/1 00:00:01/usr/local/mysql/bin/mysqld--basedir=/usr/local/mysql--datadir=/opt/mysq L/data--plugin-dir=/usr/local/mysql/lib/plugin--user=mysql--log-error=/var/log/mysqld.log--open-files-limit= 65535--pid-file=/opt/mysql/data/mysql.pid--socket=/tmp/mysqld.sock--port=3306
This article is from the "See" blog, please be sure to keep this source http://732233048.blog.51cto.com/9323668/1636409
MySQL boot error: starting mysql ... error! The server quit without updating PID file