0

I have installed some production, there is mysql embedded instance in production. Installation is successful, but when I tried to connect mysql instannce, I got following error messages.

[root@MiWiFi-R3D-srv bin]# ./mysql -u root
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/msql.sock' (2)
[root@MiWiFi-R3D-srv bin]#
[root@MiWiFi-R3D-srv bin]#

I can sure mysql instance is running.

aam      13390     1  0 08:01 ?        00:00:00 /bin/sh /opt/SIU_MANAGER/mysq /bin/mysqld_safe --defaults-file=/var/opt/SIU_MANAGER/mysql/my.cnf --pid-file=/var/opt/AAM/mysql/data/my.pid --ledir=/opt/AAM/mysql/bin --basedir=/opt/AAM/mysql --tmpdir=/var/opt/AAM/mysql/tmp/ --datadir=/var/opt/AAM/mysql/data --character-sets-dir=/opt/AAM/mysql/share/charsets/ --lc-messages-dir=/opt/AAM/mysql/share --lc-messages=en_US --user=bin
aam      13578 13390  0 08:01 ?        00:00:02 /opt/AAM/mysql/bin/mysqld --defaults-file=/var/opt/AAM/mysql/my.cnf --basedir=/opt/AAM/mysql --datadir=/var/opt/AAM/mysql/data --plugin-dir=/opt/AAM/mysql/lib/plugin --tmpdir=/var/opt/AAM/mysql/tmp/ --character-sets-dir=/opt/AAM/mysql/share/charsets/ --lc-messages-dir=/opt/AAM/mysql/share --lc-messages=en_US --log-error=MiWiFi-R3D-srv.err --pid-file=/var/opt/AAM/mysql/data/my.pid
root     17786 11762  0 08:27 pts/1    00:00:00 grep --color=auto mysql

I did little research. Mysql offical solution is that execute sql in mysql, but if I can not connect sql I can not execute any sql.

Mysql offical solution https://dev.mysql.com/doc/mysql-security-excerpt/5.7/en/account-locking.html

When used with ALTER USER, these clauses specify the new locking state for an existing account. In the absence of either clause, the account locking state remains unchanged.

This is mysql version.

[root@MiWiFi-R3D-srv bin]# ./mysqladmin -V
./mysqladmin  Ver 8.42 Distrib 5.7.25, for linux-glibc2.12 on x86_64
[root@MiWiFi-R3D-srv bin]#

How do I unlcok root user? PS: I have root privillage of OS.

Thank you for answer me.

George Zhang
  • 27
  • 1
  • 9

1 Answers1

0

It looks like, for some reason, your communication socket for MySQL is being created in /tmp, and is presumably being deleted by some process that periodically cleans up /tmp.

You can get it back by restarting the mysqld process through whatever means is appropriate to your system.

You should also move it out of /tmp, perhaps into /var/run.

chaos
  • 122,029
  • 33
  • 303
  • 309