MySQL Service start error on Ubuntu 16.04 VM- IP bind issue
Problem
Recently, my MySQL server 5.7.x wasn't starting rather it throws following error message
Job for mysql.service failed because the control process exited with error code.
See "systemctl status mysql.service" and "journalctl -xe" for details.
MySQL Error Log- /var/log/mysql/error.log
2020-07-20T14:34:56.131825Z 0 [Note] Server hostname (bind-address): '10.0.0.104'; port: 3306
2020-07-20T14:34:56.131862Z 0 [Note] - '10.0.0.104' resolves to '10.0.0.104';
2020-07-20T14:34:56.131895Z 0 [Note] Server socket created on IP: '10.0.0.104'.
2020-07-20T14:34:56.131913Z 0 [ERROR] Can't start server: Bind on TCP/IP port: Cannot assign requested address
2020-07-20T14:34:56.131920Z 0 [ERROR] Do you already have another mysqld server running on port: 3306 ?
2020-07-20T14:34:56.132002Z 0 [ERROR] Aborting
2020-07-20T14:34:56.132037Z 0 [Note] Binlog end
2020-07-20T14:34:56.132157Z 0 [Note] Shutting down plugin 'ngram'
2020-07-20T14:34:56.132175Z 0 [Note] Shutting down plugin 'ARCHIVE'
2020-07-20T14:34:56.132182Z 0 [Note] Shutting down plugin 'partition'
2020-07-20T14:34:56.132187Z 0 [Note] Shutting down plugin 'BLACKHOLE'
2020-07-20T14:34:56.132193Z 0 [Note] Shutting down plugin 'PERFORMANCE_SCHEMA'
2020-07-20T14:34:56.132254Z 0 [Note] Shutting down plugin 'MRG_MYISAM'
2020-07-20T14:34:56.132263Z 0 [Note] Shutting down plugin 'CSV'
.............................................
.............................................
2020-07-20T14:34:56.132649Z 0 [Note] InnoDB: Starting shutdown...
2020-07-20T14:34:57.647103Z 0 [Note] InnoDB: Shutdown completed; log sequence number 8204
2020-07-20T14:34:57.648555Z 0 [Note] InnoDB: Removed temporary tablespace data file: "ibtmp1"
2020-07-20T14:34:57.648579Z 0 [Note] Shutting down plugin 'MEMORY'
2020-07-20T14:34:57.648585Z 0 [Note] Shutting down plugin 'MyISAM'
2020-07-20T14:34:57.648601Z 0 [Note] Shutting down plugin 'sha256_password'
2020-07-20T14:34:57.648606Z 0 [Note] Shutting down plugin 'mysql_native_password'
2020-07-20T14:34:57.648721Z 0 [Note] Shutting down plugin 'binlog'
2020-07-20T14:34:57.649064Z 0 [Note] /usr/sbin/mysqld: Shutdown complete
Cause
Based on the error logs (/var/log/mysql/error.log), it has been identified that there is IP bind issue. This is why because I am running MySQL Server in a Ubuntu Linix VM and in network configuration I have provided DHCP. Further, since I wanted to access the database so I had configured the IP assigned to the VM that that moment in file /etc/mysql/mysql.conf.d/mysqld.cnf as:
bind-address = 10.0.0.104
Now when I restarted the VM, the IP got changed and hence the address wasn't resolved by MySQL Server in configuration settings.
Solution
The error message is very generic and there are a lot of factors can cause this error message. It is always recommended to see the error logs for actual technical problem. In my case, it was IP bind issue that I fixed by changing the bind-address in file /etc/mysql/mysql.conf.d/mysqld.cnf as:
bind-address = 0.0.0.0
Note
Although it is never advisable to do these settings in production environment as this is a major security breach to MySQL Server. This has been done for a specific development environment where MySQL server is running on a VM and has DHCP.
Thanks for sharing such a valuable information..
ReplyDeleteDevOps Training
DevOps Online Training
DevOps Online Training in Hyderabad
DevOps Online Training institute