Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

Mysql server do not start : ambari-server start

Solved Go to solution

Mysql server do not start : ambari-server start

New Contributor

We have been working our sandbox cluster and we are not able to start mysql server getting the below error:

g4t7474_[root@g4t7474 tools]# service mysqld status mysqld is stopped

g4t7474_[root@g4t7474 tools]# service mysqld start MySQL Daemon failed to start. Starting mysqld: [FAILED]

The Service stopped suddenly and when we tried to start it again it failed several times.

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Please find attached two of the tested "my.cnf" files and the logs.

my.cnf -> this is the original that was working

my.cnf.back -> tried to replicate a working one but didnt succeed.

mycnfback.txt
mycnf.txt
varlogmysqldlog.txt

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Below the mysql.sock "location"

g4t7474_[root@g4t7474 ~]# locate mysql.sock /var/lib/mysql/mysql.sock g4t7474_[root@g4t7474 ~]# ls -ld /var/lib/mysql/mysql.sock ls: cannot access /var/lib/mysql/mysql.sock: No such file or directory g4t7474_[root@g4t7474 ~]#

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Mysql server do not start : ambari-server start

New Contributor

Everything indicates that many errors occurred during the preparation of the cluster and in the same way during the installation of HDP.
We performed a re-image of everything and re-installation.
Sandbox is up now.

Thanks.

10 REPLIES 10

Re: Mysql server do not start : ambari-server start

Mentor

@Angel Mondragon

You can't connect start the database, because your socket file is a bit wrong.

If you have /var/mysql/mysql.sock but no /tmp/mysql.sock then:

<em># cd /tmp 
# ln -s /var/mysql/mysql.sock mysql.sock </em>

Use the previous working config

Then try restarting the Mysql db, please let me know if that helped

Highlighted

Re: Mysql server do not start : ambari-server start

New Contributor

Hi Geoffrey,

Thanks for your response, I tried but it didn't work. Please find the below details.
mysql.sock is located on /var/lib/mysql/mysql.sock

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

[root@g4t7474 etc]# locate mysql.sock 
/var/lib/mysql/mysql.sock

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

I tried
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

[root@g4t7474 etc]# cd /tmp/
[root@g4t7474 tmp]# ls -s /var/lib/mysql/mysql.sock mysql.sock
ls: cannot access /var/lib/mysql/mysql.sock: No such file or directory
0 mysql.sock

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

g4t7474_[root@g4t7474 tmp]# service mysqld start
MySQL Daemon failed to start.
Starting mysqld:                                           [FAILED]

Re: Mysql server do not start : ambari-server start

Contributor

@Angel Mondragon

Can you see if there is any PID value on this file /var/run/mysqld/mysqld.pid

Try to grep the process if there is any dead process hanging. if so try to kill it and remove the pid file.

Also you can delete the socket file /var/lib/mysql/mysql.sock and /tmp/mysql.sock.lock & /tmp/mysql.sock.

During the mysql restart these files will be recreated.

Re: Mysql server do not start : ambari-server start

New Contributor
g4t7474_[root@g4t7474 etc]# ls -ld /var/run/mysqld/mysqld.pid
ls: cannot access /var/run/mysqld/mysqld.pid: No such file or directory
g4t7474_[root@g4t7474 etc]# ls -ld /var/lib/mysqld/mysqld.pid ls: cannot access /var/lib/mysqld/mysqld.pid: No such file or directory
g4t7474_[root@g4t7474 etc]# locate mysqld.pid g4t7474_[root@g4t7474 etc]#

Any process hanging.

Re: Mysql server do not start : ambari-server start

Mentor

@Angel Mondragon

I think you wrongly typed the command just copy and paste. Do you see the difference in my command and yours? :-)

# cd /tmp
# ln -s /var/mysql/mysql.sock mysql.sock

Your command notice you used ls -s instead of ln -s

[root@g4t7474 etc]# cd /tmp/
[root@g4t7474 tmp]# ls -s /var/lib/mysql/mysql.sock mysql.sock
ls: cannot access /var/lib/mysql/mysql.sock: No such file or directory
0 mysql.sock

Please revert

Re: Mysql server do not start : ambari-server start

New Contributor

Same:

g4t7474_[root@g4t7474 ~]# cd /tmp
g4t7474_[root@g4t7474 tmp]# ln -s /var/mysql/mysql.sock mysql.sock
g4t7474_[root@g4t7474 tmp]# service mysqld start
MySQL Daemon failed to start.
Starting mysqld:                                           [FAILED]

Re: Mysql server do not start : ambari-server start

Mentor

@Angel Mondragon

Cold you try this

chown mysql /var/run/mysqld/mysql.sock 

Then start mysql

/usr/local/mysql/bin/safe_mysqld --user=mysql --skip-grant-tables

Re: Mysql server do not start : ambari-server start

New Contributor
g4t7474_[root@g4t7474 ~]# chown mysql /var/run/mysqld/mysql.sock
chown: invalid user: `mysql'
g4t7474_[root@g4t7474 ~]# /usr/local/mysql/bin/safe_mysqld --user=mysql --skip-grant-tables
bash: /usr/local/mysql/bin/safe_mysqld: No such file or directory



g4t7474_[root@g4t7474 ~]# ls -ld /usr/local/mysql/bin/safe_mysqld
ls: cannot access /usr/local/mysql/bin/safe_mysqld: No such file or directory
g4t7474_[root@g4t7474 ~]# locate safe_mysqld
g4t7474_[root@g4t7474 ~]#

But the i was working with root:
from: /etc/my.cnf

# 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


[mysqld]
#datadir=/var/lib/mysql
datadir=/opt/tools/mysql
socket=/var/lib/mysql/mysql.sock
#validate-password= off
innodb_data_file_path = ibdata1:10M:autoextend


[mysqladmin]
user=root


[client]
user=mysql




# 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.pi

Re: Mysql server do not start : ambari-server start

Mentor

@Angel Mondragon

Okay so you arerunning your mysql as root thats okay.

Can you check for th errors in

log-error=/var/log/mysqld.log 

And see if there is a pid in this file remove it and restart mysql you should be able to do a "safe_mysqld --user=mysql --skip-grant-tables"

pid-file=/var/run/mysqld/mysqld.pid
Don't have an account?
Coming from Hortonworks? Activate your account here