0

When I'm trying to connect to MySQL using mysql -u root -p, I got the following output:

?  ~ mysql -u root -p
Enter password: 
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (111)

I checked mysql.sock, It exists there but seems like a empty file.

?  ~ ll /var/lib/mysql/mysql.sock
srwxrwxrwx 1 mysql mysql 0 May 21 18:19 /var/lib/mysql/mysql.sock

AND When I tail -f /var/log/mysqld.log I noticed that MySQL was restarting all the time.

ps aux | grep mysql also helps me confirmed that.

?  mysql ps aux | grep mysql
mysql    31358 15.5  2.1 987400 171176 ?       Sl   13:43   0:00 /usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid
root     31386  0.0  0.0 112708   976 pts/0    S+   13:43   0:00 grep --color mysql
?  mysql 
?  mysql ps aux | grep mysql
mysql    31422 16.5  2.1 971008 172740 ?       Sl   13:43   0:00 /usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid
root     31460  0.0  0.0 112708   972 pts/0    S+   13:43   0:00 grep --color mysql
?  mysql 
?  mysql ps aux | grep mysql
mysql    31593 31.0  2.1 1020184 171800 ?      Sl   13:43   0:00 /usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid
root     31620  0.0  0.0 112708   976 pts/0    S+   13:43   0:00 grep --color mysql

The following was the outputs of the /var/log/mysqld.log:

2020-06-02T04:31:37.695633Z 0 [Note] Binlog end
2020-06-02T04:31:37.695746Z 0 [Note] Shutting down plugin 'ngram'
2020-06-02T04:31:37.695760Z 0 [Note] Shutting down plugin 'partition'
2020-06-02T04:31:37.695767Z 0 [Note] Shutting down plugin 'BLACKHOLE'
2020-06-02T04:31:37.695774Z 0 [Note] Shutting down plugin 'ARCHIVE'
2020-06-02T04:31:37.695781Z 0 [Note] Shutting down plugin 'PERFORMANCE_SCHEMA'
2020-06-02T04:31:37.695862Z 0 [Note] Shutting down plugin 'MRG_MYISAM'
2020-06-02T04:31:37.695888Z 0 [Note] Shutting down plugin 'MyISAM'
2020-06-02T04:31:37.695918Z 0 [Note] Shutting down plugin 'INNODB_SYS_VIRTUAL'
2020-06-02T04:31:37.695925Z 0 [Note] Shutting down plugin 'INNODB_SYS_DATAFILES'
2020-06-02T04:31:37.695931Z 0 [Note] Shutting down plugin 'INNODB_SYS_TABLESPACES'
2020-06-02T04:31:37.695938Z 0 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN_COLS'
2020-06-02T04:31:37.695944Z 0 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN'
2020-06-02T04:31:37.695950Z 0 [Note] Shutting down plugin 'INNODB_SYS_FIELDS'
2020-06-02T04:31:37.695957Z 0 [Note] Shutting down plugin 'INNODB_SYS_COLUMNS'
2020-06-02T04:31:37.695963Z 0 [Note] Shutting down plugin 'INNODB_SYS_INDEXES'
2020-06-02T04:31:37.695970Z 0 [Note] Shutting down plugin 'INNODB_SYS_TABLESTATS'
2020-06-02T04:31:37.695976Z 0 [Note] Shutting down plugin 'INNODB_SYS_TABLES'
2020-06-02T04:31:37.695982Z 0 [Note] Shutting down plugin 'INNODB_FT_INDEX_TABLE'
2020-06-02T04:31:37.695988Z 0 [Note] Shutting down plugin 'INNODB_FT_INDEX_CACHE'
2020-06-02T04:31:37.695994Z 0 [Note] Shutting down plugin 'INNODB_FT_CONFIG'
2020-06-02T04:31:37.696001Z 0 [Note] Shutting down plugin 'INNODB_FT_BEING_DELETED'
2020-06-02T04:31:37.696007Z 0 [Note] Shutting down plugin 'INNODB_FT_DELETED'
2020-06-02T04:31:37.696013Z 0 [Note] Shutting down plugin 'INNODB_FT_DEFAULT_STOPWORD'
2020-06-02T04:31:37.696019Z 0 [Note] Shutting down plugin 'INNODB_METRICS'
2020-06-02T04:31:37.696025Z 0 [Note] Shutting down plugin 'INNODB_TEMP_TABLE_INFO'
2020-06-02T04:31:37.696032Z 0 [Note] Shutting down plugin 'INNODB_BUFFER_POOL_STATS'
2020-06-02T04:31:37.696038Z 0 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE_LRU'
2020-06-02T04:31:37.696044Z 0 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE'
2020-06-02T04:31:37.696050Z 0 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX_RESET'
2020-06-02T04:31:37.696056Z 0 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX'
2020-06-02T04:31:37.696062Z 0 [Note] Shutting down plugin 'INNODB_CMPMEM_RESET'
2020-06-02T04:31:37.696069Z 0 [Note] Shutting down plugin 'INNODB_CMPMEM'
2020-06-02T04:31:37.696075Z 0 [Note] Shutting down plugin 'INNODB_CMP_RESET'
2020-06-02T04:31:37.696088Z 0 [Note] Shutting down plugin 'INNODB_CMP'
2020-06-02T04:31:37.696095Z 0 [Note] Shutting down plugin 'INNODB_LOCK_WAITS'
2020-06-02T04:31:37.696101Z 0 [Note] Shutting down plugin 'INNODB_LOCKS'
2020-06-02T04:31:37.696107Z 0 [Note] Shutting down plugin 'INNODB_TRX'
2020-06-02T04:31:37.696114Z 0 [Note] Shutting down plugin 'InnoDB'
2020-06-02T04:31:37.696274Z 0 [Note] InnoDB: FTS optimize thread exiting.
2020-06-02T04:31:37.696443Z 0 [Note] InnoDB: Starting shutdown...
2020-06-02T04:31:37.796721Z 0 [Note] InnoDB: Dumping buffer pool(s) to /var/lib/mysql/ib_buffer_pool
2020-06-02T04:31:37.797439Z 0 [Note] InnoDB: Buffer pool(s) dump completed at 200602 12:31:37
2020-06-02T04:31:39.307303Z 0 [Note] InnoDB: Shutdown completed; log sequence number 1426867487
2020-06-02T04:31:39.310233Z 0 [Note] InnoDB: Removed temporary tablespace data file: "ibtmp1"
2020-06-02T04:31:39.310264Z 0 [Note] Shutting down plugin 'MEMORY'
2020-06-02T04:31:39.310280Z 0 [Note] Shutting down plugin 'CSV'
2020-06-02T04:31:39.310289Z 0 [Note] Shutting down plugin 'sha256_password'
2020-06-02T04:31:39.310296Z 0 [Note] Shutting down plugin 'mysql_native_password'
2020-06-02T04:31:39.310488Z 0 [Note] Shutting down plugin 'binlog'
2020-06-02T04:31:39.310742Z 0 [Note] /usr/sbin/mysqld: Shutdown complete

2020-06-02T04:31:40.010722Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2020-06-02T04:31:40.012577Z 0 [Note] /usr/sbin/mysqld (mysqld 5.7.30) starting as process 21337 ...
2020-06-02T04:31:40.017971Z 0 [Note] InnoDB: PUNCH HOLE support available
2020-06-02T04:31:40.018028Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2020-06-02T04:31:40.018038Z 0 [Note] InnoDB: Uses event mutexes
2020-06-02T04:31:40.018046Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2020-06-02T04:31:40.018055Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2020-06-02T04:31:40.018063Z 0 [Note] InnoDB: Using Linux native AIO
2020-06-02T04:31:40.018583Z 0 [Note] InnoDB: Number of pools: 1
2020-06-02T04:31:40.018811Z 0 [Note] InnoDB: Using CPU crc32 instructions
2020-06-02T04:31:40.021640Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2020-06-02T04:31:40.036065Z 0 [Note] InnoDB: Completed initialization of buffer pool
2020-06-02T04:31:40.039597Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2020-06-02T04:31:40.052480Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
2020-06-02T04:31:40.103517Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2020-06-02T04:31:40.103646Z 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2020-06-02T04:31:40.130628Z 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2020-06-02T04:31:40.131912Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.
2020-06-02T04:31:40.131937Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active.
2020-06-02T04:31:40.133041Z 0 [Note] InnoDB: Waiting for purge to start
2020-06-02T04:31:40.183270Z 0 [Note] InnoDB: 5.7.30 started; log sequence number 1426867487
2020-06-02T04:31:40.184000Z 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
2020-06-02T04:31:40.184345Z 0 [Note] Plugin 'FEDERATED' is disabled.
2020-06-02T04:31:40.184526Z 0 [Note] InnoDB: Buffer pool(s) load completed at 200602 12:31:40
2020-06-02T04:31:40.190222Z 0 [ERROR] unknown variable 'validate_password_policy=LOW'
2020-06-02T04:31:40.190249Z 0 [ERROR] Aborting

It cloud be stopped by run service mysqld stop command, but when I try to restart It will show error again:

?  mysql service mysqld start  
Redirecting to /bin/systemctl start mysqld.service
Job for mysqld.service failed because the control process exited with error code. See "systemctl status mysqld.service" and "journalctl -xe" for details.

?  mysql 
?  mysql journalctl -xe
Jun 02 14:09:13 node72 systemd[1]: Failed to start MySQL Server.
-- Subject: Unit mysqld.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit mysqld.service has failed.
-- 
-- The result is failed.
Jun 02 14:09:13 node72 systemd[1]: Unit mysqld.service entered failed state.
Jun 02 14:09:13 node72 systemd[1]: mysqld.service failed.
Jun 02 14:09:13 node72 polkitd[1143]: Unregistered Authentication Agent for unix-process:1669:824444 (system bus name :1.431, object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8) (dis
Jun 02 14:09:13 node72 systemd[1]: mysqld.service holdoff time over, scheduling restart.
Jun 02 14:09:13 node72 systemd[1]: Stopped MySQL Server.
-- Subject: Unit mysqld.service has finished shutting down
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit mysqld.service has finished shutting down.
Jun 02 14:09:13 node72 systemd[1]: Starting MySQL Server...
-- Subject: Unit mysqld.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit mysqld.service has begun starting up.
Jun 02 14:09:13 node72 mysqld[1777]: Initialization of mysqld failed: 0
Jun 02 14:09:13 node72 systemd[1]: mysqld.service: control process exited, code=exited status=1
Jun 02 14:09:15 node72 systemd[1]: Failed to start MySQL Server.
-- Subject: Unit mysqld.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit mysqld.service has failed.
-- 
-- The result is failed.
Jun 02 14:09:15 node72 systemd[1]: Unit mysqld.service entered failed state.
Jun 02 14:09:15 node72 systemd[1]: mysqld.service failed.
Jun 02 14:09:15 node72 systemd[1]: mysqld.service holdoff time over, scheduling restart.
Jun 02 14:09:15 node72 systemd[1]: Stopped MySQL Server.
-- Subject: Unit mysqld.service has finished shutting down
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit mysqld.service has finished shutting down.
Jun 02 14:09:15 node72 systemd[1]: Starting MySQL Server...
-- Subject: Unit mysqld.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit mysqld.service has begun starting up.
Jun 02 14:09:16 node72 mysqld[1835]: Initialization of mysqld failed: 0
Jun 02 14:09:16 node72 systemd[1]: mysqld.service: control process exited, code=exited status=1

This's the second time I have encountered this problem, I don't know what's wrong with it. In the first time, I did a re-installation to escape this problem, Now I ran into this problem again. I'm just using MySQL in general and which works fine since last re-installation.

Here's some information that might help:

MySQL version

mysql  Ver 14.14 Distrib 5.7.30, for Linux (x86_64) using  EditLine wrapper

Linux distribution

Cent OS Linux release 7.6.1810 (Core)

MySQL Configurations in /etc/my.cnf

[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
explicit_defaults_for_timestamp=true

symbolic-links=0

log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

validate_password_policy=LOW
character_set_server=utf8
init_connect='SET NAMES utf8'

sql_mode ='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'

[client]
default-character-set=utf8
socket=/var/lib/mysql/mysql.sock

[mysql]
default-character-set=utf8
socket=/var/lib/mysql/mysql.sock

Thanks for your time, Any help would be appreciated.

I checked the question mysql-validate-password-policy-unknown-system-variable but It wasn't help for me. And I read the MySQL doc from https://dev.mysql.com/doc/refman/5.7/en/validate-password-installation.html.

There is a Note says:

If you installed MySQL 5.7 using the MySQL Yum repository, MySQL SLES Repository, or RPM packages provided by Oracle, validate_password is enabled by default after you start your MySQL Server for the first time.

In my case, I had installed My MySQL 5.7 by using the MySQL Yum repository, AND At last res-installation to this problem came up, The plugin is worked fine. So I put the line validate_password_policy=LOW to /etc/.cnf to solve MySQL default password policy at installation phase before.

Jo1y
  • 1
  • 1
  • According to your error message, https://stackoverflow.com/questions/55237257/mysql-validate-password-policy-unknown-system-variable could help. If not, please share your attempts to resolve the problem – Nico Haase Jun 02 '20 at 06:29
  • Does this answer your question? [MySQL validate\_password\_policy unknown system variable](https://stackoverflow.com/questions/55237257/mysql-validate-password-policy-unknown-system-variable) – Elias Soares Jun 02 '20 at 06:35
  • Thank you for your comment. I can't install the plugin by connecting to the mysql host now, is there any other way to do it? – Jo1y Jun 02 '20 at 06:36
  • It's finally worked by doing a comment to `validate_password_policy=LOW` in `/etc/my.cnf`. And I also found that the plugin 'validate_password' was not installed in my MySQL Server. After I installed it, this problem solved. – Jo1y Jun 02 '20 at 08:39

0 Answers0