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
Related
I try to change Mysql 5.6 data directory in centos 7 from default dir /var/lib/mysql to target dir /data1/mysqldata/mysql.
Follow is my operation step by step
1.Stop mysql service
2.Create target directory and chown
mkdir /data1/mysqldata
chown -R mysql:mysql /data1/mysqldata
2.Change /etc/my.cfg to below code
[mysqld]
datadir=/data1/mysqldata/mysql
socket=/data1/mysqldata/mysql/mysql.sock
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
# Recommended in standard MySQL setup
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
[client]
port=3306
socket=/data1/mysqldata/mysql/mysql.sock
4.Move data from default directory to target
mv /var/lib/mysql /data1/mysqldata/
5.Start mysql service
But I get error from /var/log/mysqld.log like this
190813 10:40:23 mysqld_safe Logging to '/var/log/mysqld.log'.
190813 10:40:23 mysqld_safe Directory '/data1/mysqldata/mysql' for UNIX socket file don't exists.
It's strange that Mysql run normaly in the default directory /var/lib/mysql when I undo all my config
My machine version is CentOS Linux release 7.6.1810 (Core), and Mysql Version is mysql Ver 14.14 Distrib 5.6.45, for Linux (x86_64)
I upgraded mysql to 5.7.21 on RHEL6. I created my self-signed certificates and added correct path in my.cnf, however, now I am getting ERROR 2026 when trying to connect normally. I can connect only when I explicitly specify SSL_DISABLED.
I have double checked for RSA appearing in key files. Relevant files are:
[root#my-DB1 log]# mysql -u myuser -p
Enter password:
ERROR 2026 (HY000): SSL connection error: SSL is required but the server doesn't support it
my.cnf
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
#localhost
#sql_mod="NO_AUTO_CREATE_USER"
# Settings user and group are ignored when systemd is used.
# 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
ssl-ca=/var/lib/mysql/ca.pem
ssl-cert=/var/lib/mysql/server-cert.pem
ssl-key=/var/lib/mysql/server-key.pem
ssl_capath=/var/lib/mysql/
ssl-cipher=ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-DSS-AES256-GCM-SHA384:DHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA256:DHE-RSA-AES256-SHA:DHE-DSS-AES256-SHA:DHE-RSA-CAMELLIA256-SHA:DHE-DSS-CAMELLIA256-SHA:ECDH-RSA-AES256-GCM-SHA384:ECDH-ECDSA-AES256-GCM-SHA384:ECDH-RSA-AES256-SHA384:ECDH-ECDSA-AES256-SHA384:ECDH-RSA-AES256-SHA:ECDH-ECDSA-AES256-SHA:AES256-GCM-SHA384:AES256-SHA256:AES256-SHA:CAMELLIA256-SHA:PSK-AES256-CBC-SHA:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:DHE-DSS-AES128-GCM-SHA256:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES128-SHA256:DHE-DSS-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA:ECDHE-RSA-DES-CBC3-SHA:ECDHE-ECDSA-DES-CBC3-SHA:DHE-RSA-SEED-SHA:DHE-DSS-SEED-SHA:DHE-RSA-CAMELLIA128-SHA:DHE-DSS-CAMELLIA128-SHA:EDH-RSA-DES-CBC3-SHA:EDH-DSS-DES-CBC3-SHA:ECDH-RSA-AES128-GCM-SHA256:ECDH-ECDSA-AES128-GCM-SHA256:ECDH-RSA-AES128-SHA256:ECDH-ECDSA-AES128-SHA256:ECDH-RSA-AES128-SHA:ECDH-ECDSA-AES128-SHA:ECDH-RSA-DES-CBC3-SHA:ECDH-ECDSA-DES-CBC3-SHA:AES128-GCM-SHA256:AES128-SHA256:AES128-SHA:SEED-SHA:CAMELLIA128-SHA:DES-CBC3-SHA:IDEA-CBC-SHA:PSK-AES128-CBC-SHA:PSK-3DES-EDE-CBC-SHA:KRB5-IDEA-CBC-SHA:KRB5-DES-CBC3-SHA:KRB5-IDEA-CBC-MD5:KRB5-DES-CBC3-MD5:ECDHE-RSA-RC4-SHA:ECDHE-ECDSA-RC4-SHA:ECDH-RSA-RC4-SHA:ECDH-ECDSA-RC4-SHA:RC4-SHA:RC4-MD5:PSK-RC4-SHA:KRB5-RC4-SHA:KRB5-RC4-MD5
[client]
ssl-ca=/var/lib/mysql/ca.pem
ssl-cert=/var/lib/mysql/client-cert.pem
ssl-key=/var/lib/mysql/client-key.pem
[mysqld_safe]
log-error=/var/log/mysql55-mysqld.log
pid-file=/opt/rh/mysql55/root/var/run/mysqld/mysqld.pid
/var/log/mysql directory contents:
[root#my-DB1 log]# ls /var/lib/mysql
auto.cnf client-cert.pem ibdata1 ibtmp1 logs.000003 logs.index mysql.sock.lock public_key.pem my_db
ca-key.pem client-key.pem ib_logfile0 logs.000001 logs.000004 mysql performance_schema server-cert.pem
ca.pem ib_buffer_pool ib_logfile1 logs.000002 logs.000005 mysql.sock private_key.pem server-key.pem
Any idea where am I missing?
Thanks
Re-generated certificates with keeping in mind that the CN should be different for all 3.
Changed ownership on newly generated certificates to match mysql:mysql .
Restarted mysql and this error is out.
Thanks
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.
I restarted server where mysql is installed since then it is not getting started below is the error log i got when the try to start mysqld service.I checked whether any mysqld_safe is running using ps ax | grep mysql seems nothing is running
160506 08:54:53 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
160506 08:54:59 mysqld_safe Starting mysqld daemon with databases from /data/mysql
160506 8:54:59 [ERROR] /usr/libexec/mysqld: ambiguous option '--i' (ignore-builtin-innodb, interactive_timeout)
160506 8:54:59 [ERROR] Aborting
160506 08:54:59 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
My.cnf
[mysqld]
server-id=832
#datadir=/var/lib/mysql
#datadir=/database/mysql/data
datadir=/data/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
# Default to using old password format for compatibility with mysql 3.x
# clients (those using the mysqlclient10 compatibility package).
old_passwords=1
lower_case_table_names=1
max_connections=2048
#check
# this happens when max_allowed_packet=1M but not when max_allowed_packet=2M,
i# actually 1638400 is already fine
max_allowed_packet=1024M
key_buffer=128M
max_user_connections=32768
tmp_table_size=128M
table_cache=524288 # old value is 1024M
query_cache_size=512M
query_cache_type=1
sort_buffer=128M
join_buffer_size=32M
read_buffer=128M
#set-variable = write_buffer=128M Timeout occurs if opened this
#record_buffer=128M old parameter please use read_buffer_size instead
read_buffer_size=512M # old value is 128M
myisam_sort_buffer_size=64M
myisam_max_sort_file_size=2G
back_log=100
interactive_timeout=10000
wait_timeout=1000
connect_timeout=1000
net_read_timeout=1000
open_files_limit=30000
thread_concurrency=512
thread_cache_size=16384 #old value is 128M
thread_stack=8M
#end of check
## extra parameters verify and remove
#TransactionDeadlockDetectionTimeout=100 Notworking
#HeartbeatIntervalDbDb=3000
#HeartbeatIntervalDbApi=3000
#innodb_buffer_pool_size=4096M
innodb_buffer_pool_size=1G
innodb_additional_mem_pool_size=512M
innodb_thread_concurrency=0
innodb_file_per_table=1
sort_buffer=128M
#log_slow_queries=ON
slow_query_log=/database/mysql/log/slowlog
max_sp_recursion_depth=5
## upto Here
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
Re-installing mysql binaries does the job for me
I am unable to start mysql on centos vmware.
I am trying to see the log file but I cant figure out how to open the file and see any error messages in it. Can someone show how to open the log file
the file does exist and returned this when I ran
ls -l mysqld.log
-rw-r-----. 1 mysql mysql 1279 Apr 21 08:12 mysqld.log
however, when I do this
gedit mysqld.log
I get this error message in gedit window.
"Could not open the file /var/log.mysqld.log"
"you dont have the permissions n ecessary to open the file."
so how to view contents of this file
here are the contents of my.cnf file if it helps
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
Have you tried "sudo" command?
(if you have the super user permission.)
I mean:
$ sodu gedit mysqld.log
and then input your password.