I have an amazon ec2 instance running on Amazon Linux AMI. I'm trying to move the data directory for mysql on a second volume (mounted on /home/ec2-user/data) with following config file (/etc/my.cnf) but mysql fails to start:
[mysqld]
datadir=/home/ec2-user/data/mysql
socket=/home/ec2-user/data/mysql/mysql.sock
log-bin=/var/log/mysql/mariadb-bin
log-bin-index=/var/log/mysql/mariadb-bin.index
symbolic-links=0
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
[client]
port=3306
socket=/home/ec2-user/data/mysql/mysql.sock
I get these error messages in the log file:
2017-10-12 14:06:33 20082 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
2017-10-12 14:06:33 20082 [ERROR] Can't start server : Bind on unix socket: Permission denied
2017-10-12 14:06:33 20082 [ERROR] Do you already have another mysqld server running on socket: /home/ec2-user/data/mysql/mysql.sock ?
2017-10-12 14:06:33 20082 [ERROR] Aborting
When I set the config file back to former settings (to the backup of the data folder) everything works fine:
[mysqld]
datadir=/var/lib/mysql.bak
socket=/var/lib/mysql.bak/mysql.sock
log-bin=/var/log/mysql/mariadb-bin
log-bin-index=/var/log/mysql/mariadb-bin.index
symbolic-links=0
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
[client]
port=3306
socket=/var/lib/mysql.bak/mysql.sock
What could be the cause of this problem? I've already checked for the permissions on the new data folder but that doesn't change anything.
Run this command:
chgrp -R mysql /home/ec2-user/data/mysql
chown -R mysql /home/ec2-user/data/mysql
Can you try the following config file ?
[mysqld]
datadir=/home/ec2-user/data/mysql
socket=/var/lib/mysql.bak/mysql.sock
log-bin=/var/log/mysql/mariadb-bin
log-bin-index=/var/log/mysql/mariadb-bin.index
symbolic-links=0
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
[client]
port=3306
socket=/var/lib/mysql.bak/mysql.sock
In my my.cnf, I write:
[mysqld_multi]
mysqld = /usr/local/Cellar/mysql/5.7.11/bin/mysqld_safe
mysqladmin = /usr/local/Cellar/mysql/5.7.11/bin/mysqladmin
user = root
password =
[mysqld1]
pid-file = /usr/local/etc/mysql/mysqld.pid
socket = /usr/local/etc/mysql/mysqld.sock
port = 3306
datadir = /usr/local/var/mysql
log-bin=mysql-bin
server-id=1
[mysqld2]
pid-file = /usr/local/etc/mysql/mysqld1.pid
socket = /usr/local/etc/mysql/mysqld1.sock
port = 3307
datadir = /usr/local/var/mysql1
server-id=2
language=/usr/local/Cellar/mysql/5.7.11/share/mysql/english
user=mysql
Then I execute mysqld_multi start 2, and I get the error info:
Installing new database in /usr/local/var/mysql1
2016-09-19 19:37:16 [WARNING] mysql_install_db is deprecated. Please consider switching to mysqld --initialize
2016-09-19 19:37:16 [ERROR] Can't locate the language directory.
FATAL ERROR: Tried to start mysqld under group [mysqld2],
but no data directory was found or could be created.
data directory used: /usr/local/var/mysql1
I can't start the mysql process, so what's the problem? It seems the directory /usr/local/var/mysql1 has some problems, but the directory exists, it's confused.
It seems like mysqld_multi wasn't fixed to use mysqld --initialize.
You will have to run mysqld --initialize along with all directory related options in my.cnf for that server.
(from comment)
You can also fix the mysqld_multi script following the instructions in Running two instances of mysql.
All the good days. I want to run for test purposes Percona XtraDb Cluster on ubuntu 14.04. The basis here took these two articles
https://habrahabr.ru/post/152969/
https://www.percona.com/doc/percona-xtradb-cluster/5.6/manual/bootstrap.html
I came instead
Ну и в завершение, перезапускаем демона:
The daemon does not start
$ sudo /etc/init.d/mysql start
* Starting MySQL (Percona XtraDB Cluster) database server mysqld
* The server quit without updating PID file (/var/lib/mysql/vagrant-ubuntu-trusty-64.pid).
...fail!
The logs several errors. Error one:
[ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
Sure I ran mysql_upgrade, but it does not work
$ sudo mysql_upgrade
Looking for 'mysql' as: mysql Looking for 'mysqlcheck' as: mysqlcheck
FATAL ERROR: Upgrade failed
Error two:
160502 14:56:26 [ERROR] Plugin 'InnoDB' init function returned error.
160502 14:56:26 [ERROR] Plugin 'InnoDB' registration as a STORAGE
ENGINE failed. 160502 14:56:26 [ERROR] Unknown/unsupported storage
engine: InnoDB 160502 14:56:26 [ERROR] Aborting
All are advised to remove all of the folders / var / lib / mysql and supposedly starts. But I deleted and nothing worked.
My file my.cnf
[mysqld_safe]
# wsrep_urls=gcomm://192.168.33.101:3400,gcomm://192.168.33.102:3400,gcomm://
#wsrep_urls=gcomm://192.168.33.101:3400,gcomm://
[mysqld]
innodb_log_file_size=256M
wsrep_cluster_address=gcomm://192.168.33.101
port=3306
socket=/var/run/mysqld/mysqld.sock
datadir=/var/lib/mysql
basedir=/usr
user=mysql
log_error=/var/log/mysql.err
binlog_format=ROW
default_storage_engine=InnoDB
wsrep_provider=/usr/lib/libgalera_smm.so
wsrep_sst_receive_address=192.168.33.101:3500
wsrep_node_incoming_address=192.168.33.101
wsrep_slave_threads=2
wsrep_cluster_name=cluster0
wsrep_provider_options="gmcast.listen_addr=tcp://192.168.33.101:3400;"
wsrep_sst_method=xtrabackup
wsrep_sst_auth=backup:password
wsrep_node_name=node0
innodb_locks_unsafe_for_binlog=1
innodb_autoinc_lock_mode=2
innodb_buffer_pool_size=5000M
innodb_log_file_size=256M
innodb_log_buffer_size=4M
[client]
port=3306
socket=/var/run/mysqld/mysqld.sock
Actually the question: how to start? If there is anyone working configuration, then please share.
For the record:
Percona is amazing, but highly undocumented.
When it comes to configuring it, ive learned less is better.
important parts:
server-id required
these may be braking it, in my experience.
wsrep_sst_receive_address=192.168.33.101:3500
wsrep_node_incoming_address=192.168.33.101
Config from my cluster:
[mysqld]
server-id=18
datadir=/var/lib/mysql
wsrep_provider=/usr/lib/libgalera_smm.so
# Cluster connection URL -|-node0, -|-node1, -|-node2 -|-node3 -|-node4 -|-node5 -|-node6 -|-node7 -|-node8
wsrep_cluster_address=gcomm://192.168.1.18,192.168.1.19,192.168.1.20 #removed some
binlog_format=ROW
default_storage_engine=InnoDB
innodb_autoinc_lock_mode=2
wsrep_sst_method=rsync
wsrep_sst_auth="root:password"
wsrep_cluster_name=grapes
innodb_buffer_pool_size=5140
innodb_buffer_pool_instances=4
innodb_flush_log_at_trx_commit=0
query_cache_size=0
Below is my MySQL config file. I am trying to understand how it works. What is the point of [mysqld_safe]? Hasn't [mysqld] already start MySQL? Why is the log-error and pid-file settings after it?
[mysqld]
# Settings user and group are ignored when systemd is used (fedora >= 15).
# If you need to run mysqld under different user or group,
# customize your systemd unit file for mysqld according to the
# instructions in http://fedoraproject.org/wiki/Systemd
user=mysql
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
# Semisynchronous Replication
# http://dev.mysql.com/doc/refman/5.5/en/replication-semisync.html
# uncomment next line on MASTER
;plugin-load=rpl_semi_sync_master=semisync_master.so
# uncomment next line on SLAVE
;plugin-load=rpl_semi_sync_slave=semisync_slave.so
# Others options for Semisynchronous Replication
;rpl_semi_sync_master_enabled=1
;rpl_semi_sync_master_timeout=10
;rpl_semi_sync_slave_enabled=1
# http://dev.mysql.com/doc/refman/5.5/en/performance-schema.html
;performance_schema
innodb_strict_mode=on
sql_mode=TRADITIONAL
;sql_mode=STRICT_TRANS_TABLES,NO_ZERO_DATE,NO_ZERO_IN_DATE
character-set-server=utf8
collation-server=utf8_general_ci
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
You can start MySQL server using either mysqld or mysqld_safe. mysqld_safe may itself try to execute mysqld but also may not. See the documentation (the first result in Google for mysqld_safe, btw):
mysqld_safe is the recommended way to start a mysqld server on Unix and NetWare. mysqld_safe adds some safety features such as restarting the server when an error occurs and logging runtime information to an error log file. NetWare-specific behaviors are listed later in this section.
Section [mysqld_safe] in the configuration file is for settings applied when you use mysqld_safe to start MySQL server instead of mysqld.
I am getting following error while starting mysql ...can someone help:
]# service mysql start
Starting MySQL.Manager of pid-file quit without updating fi[FAILED]
Following is my my.cnf file...
** my.cnf file *****
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
table_cache = 2048
innodb_buffer_pool_size = 2G
innodb_file_per_table
innodb_log_buffer_size = 8M
innodb_log_file_size = 128M
innodb_additional_mem_pool_size = 4M
innodb_table_locks = 0
default-storage-engine=InnoDB
join_buffer_size = 2M
query_cache_size = 512M
query_cache_limit = 2M
sort_buffer_size = 8M
read_buffer_size = 8M
read_rnd_buffer_size = 4M
key_buffer = 512M
key_buffer_size = 256M
max_allowed_packet = 16M
max_connections = 250
long_query_time = 5
log_slow_queries = ekb-qa-app-02-slow.log
innodb_autoinc_lock_mode=2
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
I received the exact same error...which ended up being misleading to me. The problem (at least for me) ended up being that I had filled the disk to capacity. Try df -h and see if you are at capacity. Hope that helps, and that this error was caused by this as well for you ( since it is simple to fix :) ).
This can be happen due to two reasons:
mysqld is trying to write logs to the disk, which is full.
mysqld is trying to write logs to the file but it doesn't have appropriate permissions.
Try running the mysqld_safe directly and see if the error message is more specific about your problem. This way I was able to realize the my log file had a permissions problem.
For me, the issue was insufficient privileges to the mysql data files. The data files were copied over from another file system as root. Once I changed the group and ownership of the files to mysql:mysql the error went away.
The /etc/init.d/mysql[d] startup script can also outsmart itself by printing overlapping error messages, but you only end up seeing one. You may also see "[FAILED]" or "[OK]" overlapping in the middle of the script output, and some of this may even depend on the exact terminal software you use.
Meanwhile, in my case, the true error was buried underneath this:
Manager of pid-file quit wi[FAILED]dating file
I finally looked closely enough at my mysqld error log, and found the real issue:
/usr/sbin/mysqld: File 'MASTER/master15-bin.index' not found (Errcode: 2)
Like other similar cases here, the problem came from copying the whole /var/lib/mysql directory over from a different host. Here I was setting up a fresh replication server, and so the MASTER and SLAVE variables are different in /etc/my.cnf of course. My master binlogs are in a MASTER subdirectory.
Once I cleaned that up, everything was fine.
So this "Manager of pid-file quit" error was another red herring. I'm just adding this story here to show yet again that (1) the answer probably lies in your error log, and (2) may have nothing to do with this error you see from mysqld_safe.
I just prefix sudo command in the below statement and mysql started.
$ sudo /etc/rc.d/init.d/mysql start
Input password:
Starting MySQL.
I checked and found that MySQL is running by issuing below command:
$ mysqladmin -u root -pjoomla1 ping
mysqld is alive
For me the issue was with multiple my.cnf file put in server , removing one of it(wrong file) helped me resolve the issue
If you have mysql on it's own partition (such as /var/lib/mysql), make sure that it hasn't gone read-only. to do this, attempt to create (touch) a file in that partition. if it has gone read-only, it will let you know and you will need to run a manual fsck on that partition. first make sure there are no running processes ( lsof /var/lib/mysql | awk '{print $1}'|sort|uniq -c|awk '{print $2}') then umount the partition before fscking it.
here's what I noticed after playing with my.cnf config file to try optimum performance.
If I set innodb_log_file_size to a wrong value and I try restarting the mysql server, it shuts down ok, but when it tries to start, I get something similar to the following:
Starting MySQL.The server quit without updating PID file ([FAILED]mysql/<insert pid file here>).
Then when I checked the error log to find out whats going on, I saw all this:
140709 22:47:30 mysqld_safe mysqld from pid file /var/lib/mysql/<pid filename>.pid ended
140709 22:47:31 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
140709 22:47:31 [Warning] Using unique option prefix thread_cache instead of thread_cache_size is deprecated and will be removed...
140709 22:47:31 [Note] Plugin 'FEDERATED' is disabled.
140709 22:47:31 InnoDB: The InnoDB memory heap is disabled
140709 22:47:31 InnoDB: Mutexes and rw_locks use GCC atomic builtins
140709 22:47:31 InnoDB: Compressed tables use zlib 1.2.3
140709 22:47:31 InnoDB: Using Linux native AIO
140709 22:47:31 InnoDB: Initializing buffer pool, size = 512.0M
140709 22:47:31 InnoDB: Completed initialization of buffer pool
InnoDB: Error: log file ./ib_logfile0 is of different size 0 5242880 bytes
InnoDB: than specified in the .cnf file 0 67108864 bytes!
140709 22:47:31 [ERROR] Plugin 'InnoDB' init function returned error.
140709 22:47:31 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
140709 22:47:31 [ERROR] Unknown/unsupported storage engine: InnoDB
140709 22:47:31 [ERROR] Aborting
140709 22:47:31 [Note] /usr/sbin/mysqld: Shutdown complete
140709 22:47:31 mysqld_safe mysqld from pid file /var/lib/mysql/<pid filename>.pid ended
Except that I replaced the pid filename with "pid filename".
Websites think you can set innodb_log_file_size to a value but something is trying to tell me that it is a value that the mysql server calculates and its something you can't set.
This suggestion will HELP also.
REMOVE the following list so DEFAULTS can support your effort from [mysqld] section of my.cnf/.ini
sort_buffer_size
read_buffer_size
read_rnd_buffer_size
join_buffer_size
to improve(reduce) response time.
Why would you intentionally read 16M of read_rnd_buffer_size data when you could get the data you need with the DEFAULT of 256K ?
i think it will fix via hash
query_cache
you didn't mention what system are you using here. For CentOS, Fedora, and Red Hat Enterprise Linux, use service mysqld instead of mysql
sudo /etc/init.d/mysqld start
I believe the issue might be with the variable "performance_schema" found within your my.cnf file. This variable should be commented out. Give it a try.