Last active
December 18, 2015 05:28
-
-
Save jlyon/5732451 to your computer and use it in GitHub Desktop.
MySQL won't start
Basic commands to try to resuscitate a MySQL server that won't start.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# show processlist | |
mysql -uroot -p | |
SHOW PROCESSLIST; | |
# kill all processes | |
ps aux | grep mysql | |
kill -9 <pid> | |
# try restarting (mysqld_safe if nec) | |
service mysql start | |
/bin/bash /usr/bin/mysqld_safe --user=mysql & | |
# to stop mysql safe | |
mysqladmin -uroot -p shutdown | |
# enabled error logging and look at the logs | |
nano /etc/mysql/my.cnf | |
#set: log_bin = /var/log/mysql/mariadb-bin | |
tail -n 100 /var/log/mysql/mysqld.error.log | |
# get db size | |
SELECT table_schema "dbname", sum( data_length + index_length ) / 1024 / 1024 "DB Size in MB" | |
FROM information_schema.TABLES GROUP BY table_schema ; | |
# NEW USER | |
mysql -u root -p | |
CREATE DATABASE demo; | |
GRANT ALL ON demo.* TO user1@localhost IDENTIFIED BY 'mypassword'; | |
FROM: http://www.cyberciti.biz/faq/mysql-user-creation/ | |
mysqldump db_name tables |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment