mysqld_multi error during start - mysql

hy guys,
i had a problem with mysqld_multi since 2 days.
I had to run fsck because i had a problem with the hard drive after this i encounter this issue.
When i try to start mysqld_multi with verbose i receive this error:
WARNING: mysqld_safe is beign used to start mysql. In this case you may need to pass "ledir=..." under groups [mysqldN] to mysqld_safe in order to find the actual mysqld binary. ledir (library executable directory) should be the path to the wanted mysqld binary.
This is my my.cnf
[mysqld_multi]
mysqld=/usr/bin/mysqld_safe
mysqladmin=/usr/bin/mysqladmin
log=/var/log/mysqld_multi.log
user=multi_admin
password=secret
[mysqld1]
port=1111
datadir=/var/lib/mysql-databases/mysqld1
pid-file=/var/lib/mysql-databases/mysqld1/mysql.pid
socket=/var/lib/mysql-databases/mysqld1/mysql.sock
user=mysql
server-id=1111
relay-log=/var/log/mysql1/mysql-relay-bin.log
log_bin=/var/log/mysql1/mysql-bin.log
binlog_do_db=database1
i hope somebody could help me
thanks

First, you need to find the mysqld file location.
[root#xyz ~]# find / -name mysqld
/usr/libexec/mysqld
[root#xyz ~]#
Then you need just to add the following lines to your my.cnf file.
[mysqld_multi]
mysqld=/usr/bin/mysqld_safe
mysqladmin=/usr/bin/mysqladmin
log=/var/log/mysqld_multi.log
user=multi_admin
password=secret
[mysqld1]
port=1111
datadir=/var/lib/mysql-databases/mysqld1
pid-file=/var/lib/mysql-databases/mysqld1/mysql.pid
socket=/var/lib/mysql-databases/mysqld1/mysql.sock
user=mysql
server-id=1111
relay-log=/var/log/mysql1/mysql-relay-bin.log
log_bin=/var/log/mysql1/mysql-bin.log
binlog_do_db=database1
mysqld=mysqld_safe ---> only script name of mysqld_safe
ledir=/usr/libexec --> location of mysqld file

Related

mysql : sudo mysqld_safe --skip-grant-tables & hangs

I have accidentally deleted all mysql users and hence not able to access any database.
i am using http://www.kevssite.com/2011/07/02/deleted-rootlocalhost-account-in-mysql/ link to recreate root user account again.
but the problem is that whenever I issue command sudo mysqld_safe --skip-grant-tables & my scripts hangs forever. because of this i am not able to follow next steps mentioned in the above given link.
mysqld_safe Can't log to error log and syslog at the same time. Remove all --log-error configuration options for --syslog to take effect.
151130 18:17:51 mysqld_safe Logging to '/var/log/mysql/error.log'.
151130 18:17:51 mysqld_safe A mysqld process already exists
Make sure to kill mysqld first before running mysqld_safe:
killall mysqld mysqld_safe
# give it 10 seconds or so to shut down cleanly
ps aux | grep mysqld
# if you still see mysqld, more violent action might be needed,
# but it might
# corrupt your data. But if it a test or empty install, no problem
killall -9 mysqld mysqld_safe
# now mysqld_safe should start
And you should also remove either syslog or log-error from my.cnf to address the complaint in the first error message from mysqld_safe.

centos: Another MySQL daemon already running with the same unix socket

I have a strange error when starting mysqld service:
Another MySQL daemon already running with the same unix socket.
I've tried to list running services and stopping them but the same error happens when starting mysqld service.
I can try to remove the mysqld and reinstall it but will this remove the database too?
To prevent the problem from occurring, you must perform a graceful shutdown of the server from the command line rather than powering off the server.
# shutdown -h now
This will stop the running services before powering down the machine.
Based on Centos, an additional method for getting it back up again when you run into this problem is to move mysql.sock:
# mv /var/lib/mysql/mysql.sock /var/lib/mysql/mysql.sock.bak
# service mysqld start
Restarting the service creates a new entry called mqsql.sock
TL;DR:
Run this as root and you'll be all set:
rm $(grep socket /etc/my.cnf | cut -d= -f2) && service mysqld start
Longer version:
You can find the location of MySQL's socket file by manually poking around in /etc/my.conf, or just by using
grep socket /etc/my.cnf | cut -d= -f2
It is likely to be /var/lib/mysql/mysql.sock. Then (as root, of course, or with sudo prepended) remove that file:
rm /var/lib/mysql/mysql.sock
Then start the MySQL daemon:
service mysqld start
Removing mysqld will not address the problem at all. The problem is that CentOS & RedHat do not clean up the sock file after a crash, so you have to do it yourself. Avoiding powering off your system is (of course) also advised, but sometimes you can't avoid it, so this procedure will solve the problem.
I have found a solution for anyone in this problem
change the socket dir to a new location in my.cnf file
socket=/var/lib/mysql/mysql2.sock
and service mysqld start
or the fast way as GeckoSEO answered
# mv /var/lib/mysql/mysql.sock /var/lib/mysql/mysql.sock.bak
# service mysqld start
My solution to this was a left over mysql.sock in the /var/lib/mysql/ directory from a hard shutdown.
Mysql thought it was already running when it was not running.
Just open a bug report with your OS vendor asking them to put the socket in /var/run so it automagically gets removed at reboot. It's a bug to keep this socket after an unclean reboot, /var/run is the spot for these kinds of files.
in order to clean automatically .sock file, place these lines in file /etc/init.d/mysqld immediately after "start)" block of code
test -e /var/lib/mysql/mysql.sock
SOCKEXIST=$?
ps cax | grep mysqld_safe
NOPIDMYSQL=$?
echo NOPIDMYSQL $NOPIDMYSQL
echo SOCKEXIST $SOCKEXIST
if [ $NOPIDMYSQL -eq 1 ] && [ $SOCKEXIST -eq 0 ] ; then
echo "NOT CLEAN"
rm -f /var/lib/mysql/mysql.sock
echo "FILE SOCK REMOVED"
else
echo "CLEAN"
fi
it worked for me. I had to do this because I have not an UPS and often we have power supply failures.
regards.
It may sometime arises when MySQL service does not shut down properly during the OS reboot.
The /var/lib/mysql/mysql.sock has been left. This prevents 'mysqld' from starting up.
These steps may help:
1: service mysqld start
killall -9 mysqld_safe mysqld
service mysqld start
2: rm /var/lib/mysql/mysql.sock
service mysqld start
To start the MySQL service, you can remove '/var/lib/mysql/mysql.sock' and start the MySQL service again:
Remove the socket file:
[root#server ~]# rm /var/lib/mysql/mysql.sock
rm: remove socket `/var/lib/mysql/mysql.sock'? yes
Start the MySQL service:
[root#server~]# service mysqld start
Starting mysqld: [ OK ]
It will help you to resolve your problem.
It's just happen because of abnormal termination of mysql service. delete or take backup of /var/lib/mysql/mysql.sock file and restart mysql.
Please let me know if in case any issue..
I just went through this issue and none of the suggestions solved my problem. While I was unable to start MySQL on boot and found the same message in the logs ("Another MySQL daemon already running with the same unix socket"), I was able to start the service once I arrived at the console.
In my configuration file, I found the following line: bind-address=xx.x.x.x. I randomly decided to comment it out, and the error on boot disappeared. Because the bind address provides security, in a way, I decided to explore it further. I was using the machine's IP address, rather than the IPv4 loopback address - 127.0.0.1.
In short, by using 127.0.0.1 as the bind-address, I was able to fix this error. I hope this helps those who have this problem, but are unable to resolve it using the answers detailed above.

Centos 6 64bit enable my.cnf

Can someone please tell me how to enable my.cnf options in CentOS 6?
I have all the expected .cnf files in /usr/share/mysql but they simply don't work.
/etc/init.d/mysqld --help --verbose
Usage: /etc/init.d/mysqld {start|stop|status|restart|condrestart|try-restart|reload|force-reload}
Default location is /etc/my.cnf as far as I'm aware of. Maybe you should try and copy them over there and restart?
my.cnf should be placed in /etc/ like /etc/my.cnf
The solution was to place the my.cnf file in /etc/mysql/my.cnf
the init.d script mysqld relais on the script in /usr/bin/my_print_defaults ..
this scripts takes as first input the "domain", e.g. mysqld_safe oder mysqld and outputs the config ..
this script merges the .cnf files from /etc/mysq/my.cnf + /etc/my.cnf + ~/.my.cnf together and outputs key=value pairs in the form of ..
]# /usr/bin/my_print_defaults mysqld
--datadir=/var/lib/mysql
--socket=/var/lib/mysql/mysql.sock
--user=mysql
--symbolic-links=0
so placing the .cnf files in /usr/share/mysql might be wrong ..

why the mysqld is located in 4 places in linux system?

I have confusion while I'm execute the command "# find / -name mysqld". Because the mysqld is located in four places which are:
/usr/libexec/mysqld
/etc/rc.d/init.d/mysqld
/var/lock/subsys/mysqld
/var/run/mysqld
What is the purpose of another three mysql daemons?
Here is the following explanations
/usr/libexec/mysqld : The actual binary executable
/etc/rc.d/init.d/mysqld : The service startup file (text file)
/var/run/mysqld : PID/run file folder (mysqld writes a run file in this folder)
/var/lock/subsys/mysqld : not sure
If you run which mysqld you should see the first one
You never run that directly
When you run service mysqld start, it calls /etc/rc.d/init.d/mysqld to kickoff a program called mysqld_safe (Run which mysqld_safe). mysqld_safe and mysqld work together to be the server daemon.
In turn, mysqld_safe will kickoff mysqld and then checks for an exit code. You can run less /etc/rc.d/init.d/mysqld and see this. If mysqld did not end due to system shutdown or a normal service mysql stop, mysqld_safe will attempt to restart mysqld.

Timeout error occurred trying to start MySQL Daemon. CentOS 5

I ran into troubles with MySQL on my CentOS.
I had some problems and backed up my database and removed mysql with all dependencies.
After that I ran reinstalled:
yum groupinstall "MySQL Database"
Installed without errors.
Running the mysql daemon:
service mysqld start
Timeout error occurred trying to start MySQL Daemon.
Starting MySQL: [FAILED]
I also ran
# /usr/bin/mysql_install_db --user=mysql
Installing MySQL system tables...
120112 1:49:44 [ERROR] Error message file '/usr/share/mysql/english/errmsg.sys' had only 480 error messages,
but it should contain at least 481 error messages.
Check that the above file is the right version for this program!
120112 1:49:44 [ERROR] Aborting
Installation of system tables failed!
Examine the logs in /var/lib/mysql for more information.
You can try to start the mysqld daemon with:
/usr/libexec/mysqld --skip-grant &
and use the command line tool
/usr/bin/mysql to connect to the mysql
database and look at the grant tables:
shell> /usr/bin/mysql -u root mysql
mysql> show tables
Try 'mysqld --help' if you have problems with paths. Using --log
gives you a log in /var/lib/mysql that may be helpful.
The latest information about MySQL is available on the web at
http://www.mysql.com
Please consult the MySQL manual section: 'Problems running mysql_install_db',
and the manual section that describes problems on your OS.
Another information source is the MySQL email archive.
Please check all of the above before mailing us!
And if you do mail us, you MUST use the /usr/bin/mysqlbug script!
Checking the logs:
less /var/log/mysqld.log
Log file is empty. I don't even know how to debug it and not sure what to do.
Any recommendations?
Thank you
I know you asked this a long time ago, but since people who search for "Timeout error occurred trying to start MySQL Daemon." may end up here, there are several possible solutions to that error. Here are some of them:
First, instead of running service mysqld start or service mysqld restart try running:
$ service mysqld stop; mysqld_safe &
There are known problems with the mysqladmin lines in the /etc/init.d/mysqld script.
If this isn't working, try the following things: check if there is enough free disk space (especially in /var):
$ df -h
Check for possible error messages in these files (not all of them may exist):
# tail -n 30 /var/log/messages
# tail -n 30 /var/log/mysqld.log
# tail -n 30 /var/lib/mysql/*.err
# tail -n 30 /var/log/mysql/error.log
Next up, make sure that /etc/my.cnf uses...
socket=/var/lib/mysql/mysql.sock
...and that the directory /var/lib/mysql/ actually exists.
Set the correct permissions and ownerships:
# chown -R mysql.mysql /var/lib/mysql/
# chmod g+w /var/run/mysqld/
# chgrp mysql /var/run/mysqld/
Still not working? Try changing the bind-address in my.cnf to 127.0.0.1 or 0.0.0.0, or comment out that line.
If you're still out of luck, search for more information about mysql_install_db and since your InnoDB database may be broken also look into set-variable=innodb_force_recovery=6.
Hey sometimes it's because you ran out of disk space... so run a cursory df -h to be sure! (This JUST happened to me :P).
Before starting the mysql server rename files /var/lib/mysql/ib_logfile0 and /var/lib/mysql/ib_logfile0 then restart the server
in linux/unix
mv /var/lib/mysql/ib_logfile0 /var/lib/mysql/ib_logfile0_old
mv /var/lib/mysql/ib_logfile1 /var/lib/mysql/ib_logfile1_old
then
service mysqld restart
In my case the cause was that i set key_buffer_size in /etc/my.cnf when i commented it out, mysqld started ok.
Try This:
rm $(grep socket /etc/my.cnf | cut -d= -f2) && service mysqld start