MySQL will not start on my Ubuntu 22.04 LTS server. It was working for a few months but then got caught in the following loop that appears to be due to a server upgrade it tries to run when it starts:
2022-11-04T18:40:51.568052Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.31-0ubuntu0.22.04.1) starting as process 8978
2022-11-04T18:40:51.581277Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2022-11-04T18:41:59.849028Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2022-11-04T18:42:03.102797Z 4 [System] [MY-013381] [Server] Server upgrade from '80030' to '80031' started.
2022-11-04T18:42:54.565027Z 4 [ERROR] [MY-013178] [Server] Execution of server-side SQL statement 'EXECUTE stmt; ' failed with error code = 1091, error message = 'Can't DROP 'PRIMARY'; check that column/key exists'.|
2022-11-04T18:42:54.569286Z 0 [ERROR] [MY-013380] [Server] Failed to upgrade server.
2022-11-04T18:42:54.569392Z 0 [ERROR] [MY-010119] [Server] Aborting
2022-11-04T18:42:55.869863Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.31-0ubuntu0.22.04.1) (Ubuntu).
My logs are just repeats of those lines over and over again.
From the logs, I am guessing the upgrade script is trying to run a query that requires DROP PRIMARY but I can't find that query.
I have tried rebooting the server and restarting with systemctl. Neither changed the behavior.
I have tried to uninstall mysql-server from the command line but it says that it is only partially installed and then tries to install and run it generating the same errors as above.
When I try to kill it, it just respawns seconds later.
How can I fix this error loop?
I tried re-installing mysql-server but it did not work. I needed to disable mysql, uninstall it, purge it, clear the configs, and THEN reinstall.
I was able to stop the error loop with the following code:
sudo systemctl stop mysql
sudo systemctl disable mysql
sudo apt remove --purge mysql*
sudo apt-get purge mysql*
sudo apt-get autoremove
sudo apt-get autoclean
sudo rm -rf /etc/mysql /var/lib/mysql /var/log/mysql
sudo apt-get install mysql-server
The disable was key to stopping the loop and the rm from the etc folders did not cause an error on install.
This was found through combining https://subscription.packtpub.com/book/big-data-and-business-intelligence/9781788395809/1/ch01lvl1sec16/uninstalling-mysql-8 and https://www.digitalocean.com/community/questions/completely-uninstall-mysql-server
Related
Like described in the title, mysql stop just after starting, i searched in a lot of topics and every solutions proposed doesn't work for me...
i'm on up to date os x with a fresh install of mysql 8.0 via DMG.
my my_pc.err file in the mysql/data folder indicate this:
2020-05-20T14:43:07.6NZ mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data
2020-05-20T14:43:07.693358Z 0 [System] [MY-010116] [Server] /usr/local/mysql/bin/mysqld (mysqld 8.0.20) starting as process 25586
2020-05-20T14:43:07.697083Z 0 [Warning] [MY-010159] [Server] Setting lower_case_table_names=2 because file system for /usr/local/mysql/data/ is case insensitive
2020-05-20T14:43:07.697155Z 0 [ERROR] [MY-010123] [Server] Fatal error: Please read "Security" section of the manual to find out how to run mysqld as root!
2020-05-20T14:43:07.697233Z 0 [ERROR] [MY-010119] [Server] Aborting
2020-05-20T14:43:07.697410Z 0 [System] [MY-010910] [Server] /usr/local/mysql/bin/mysqld: Shutdown complete (mysqld 8.0.20) MySQL Community Server - GPL.
2020-05-20T14:43:07.6NZ mysqld_safe mysqld from pid file /usr/local/mysql/data/MacBook-Pro-de-CanardWc.local.pid ended
2020-05-20T14:43:17.6NZ mysqld_safe Logging to '/usr/local/mysql/data/MacBook-Pro-de-CanardWc.local.err'.
2020-05-20T14:43:17.6NZ mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data
It's been now few years that i try to use mysql and never manage to make it working. I tried :
sudo /usr/local/mysql/support-files/mysql.server start, it gave me this :
Starting MySQL . ERROR! The server quit without updating PID file (/usr/local/mysql/data/MacBook-Pro-de-CanardWc.local.pid).
i used chmod on my mysql folder.
i changed my path on bash_profile but mysql and mysqld commands is still not found.
i also tried this:
/usr/local/mysql/bin/mysqladmin --port=8889 -u root shutdown
it responds this:
mysqladmin: connect to server at 'localhost' failed
error: 'Can't connect to local MySQL server through socket '/var/mysql/mysql.sock' (38)'
Check that mysqld is running and that the socket: '/var/mysql/mysql.sock' exists!
ps -ef | grep mysqld gave me this information :
501 22093 549 0 6:52PM ttys004 0:00.00 grep --color=auto --exclude-dir=.bzr --exclude-dir=CVS --exclude-dir=.git --exclude-dir=.hg --exclude-dir=.svn --exclude-dir=.idea --exclude-dir=.tox mysqld
/usr/local/mysql/bin/mysql -h 127.0.0.1 -P 3306 -u root -p
give this:
ERROR 2003 (HY000): Can't connect to MySQL server on '127.0.0.1' (61)
my /var/mysql/mysql.sock is empty
sudo pkill mysqld
doesn't kill the process
did a fresh reinstal using https://coderwall.com/p/os6woq/uninstall-all-those-broken-versions-of-mysql-and-re-install-it-with-brew-on-mac-mavericks but when i do mysql_secure_installation i got this error:
Error: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
After few search, i found out that that i just needed to uninstall it and reinstall it with brew. Pretty sad that the dmg doesn't work but now i can use mysql properly.
Thanks a lot for the time you took to help me <3
I installed the latest version of MySQL mysql-8.0.20-macos10.15-x86_64
When I start the server, it doesn't start. When I look into logs I see the following message:
sudo tail -n10 /usr/local/mysql/data/MacBook-Pro.local.err
2020-04-29T19:14:15.781011Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Socket: '/tmp/mysqlx.sock' bind-address: '::' port: 33060
2020-04-29T19:14:15.875568Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2020-04-29T19:14:15.881149Z 0 [ERROR] [MY-000067] [Server] unknown variable 'query_cache_size=32M'.
2020-04-29T19:14:15.882207Z 0 [ERROR] [MY-010119] [Server] Aborting
2020-04-29T19:14:16.820509Z 0 [System] [MY-010910] [Server] /usr/local/mysql/bin/mysqld: Shutdown complete (mysqld 8.0.20) MySQL Community Server - GPL.
I cannot find where query_cache_size is coming from and I didn't set it.
This is the list of files/folder in MySQL folder:
LICENSE bin docs keyring man support-files
README data include lib share
I found the fix.
Documenting my troubleshooting/fix steps, so that it can save someone else hours of debugging.
Located the my.cnf file /private/etc/my.cnf, and noticed that a lot of configs were still conflicting as I was disabling them one by one. So, I simply renamed my.cnf to my.cnf.bak i.e. forcing MySQL to create a brand new file (now god knows where it created new one, that is a mystery for some other day :) )
Started the server using sudo /usr/local/mysql/support-files/mysql.server start
The server was still not starting and it was erroring with Unable to lock ./ibdata1 error: 35
So, I killed the ghost mysql process ps aux | grep mysql and kill <process-name>
Yay! server started running.
I've been working through MySQL but I've been having trouble entering my MySQL server to change certain properties. When I attempt to enter as root I get the following output:
//]$ sudo mysqld -u root -p
Enter password:
mysqld: Can not perform keyring migration : Invalid --keyring-migration-source option.
2020-02-12T05:34:59.837715Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.19) starting as process 64421
2020-02-12T05:34:59.839462Z 0 [ERROR] [MY-011084] [Server] Keyring migration failed.
2020-02-12T05:34:59.839481Z 0 [ERROR] [MY-010119] [Server] Aborting
2020-02-12T05:34:59.839559Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.19) MySQL Community Server - GPL.
Can't figure out how to sort this out. Any help would be much appreciated.
keyring-migration-source exists in one of the configuration files.
mysqld --help --verbose will list which files are read at the top. Look in those and remove the line.
Also don't run mysqld as root. Its a security hazard and won't start. Use the systemctl start mysql that fedora provides.
Have downloaded MySQL repository through the APT repository, then already did sudo apt-get update and sudo apt-get install mysql-server. But I got the error below:
asus#asus-K40IJ:~$ sudo mysqld
[sudo] password for asus:
2018-11-10T04:34:58.070075Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2018-11-10T04:34:58.074324Z 0 [Note] mysqld (mysqld 5.7.24) starting as process 3686 ...
2018-11-10T04:34:58.077869Z 0 [ERROR] Fatal error: Please read "Security" section of the manual to find out how to run mysqld as root!
2018-11-10T04:34:58.077928Z 0 [ERROR] Aborting
2018-11-10T04:34:58.077959Z 0 [Note] Binlog end
2018-11-10T04:34:58.078047Z 0 [Note] mysqld: Shutdown complete
Why is this and how to solve this..?
It is not recommended to run 'mysqld' as root for security. But you can do it with '--user=root' option.
Please see for more details.
https://dev.mysql.com/doc/refman/8.0/en/security-against-attack.html
I am looking at these instructions to reset the mysql root password on an Ubuntu development machine.
#> sudo /etc/init.d/mysql stop
[ ok ] Stopping mysql (via systemctl): mysql.service.
Seems to work but then
#> sudo /usr/sbin/mysqld --skip-grant-tables --skip-networking
2016-09-04 15:27:13 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2016-09-04 15:27:13 0 [Note] /usr/sbin/mysqld (mysqld 5.6.31-0ubuntu0.15.10.1) starting as process 8892 ...
This process exits. Afterwards, when I try
#> mysql -u root
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
What's going wrong?