Created
April 5, 2017 07:12
-
-
Save luisfc/dc8186be9aba0938e65f7e4d62ea2bb5 to your computer and use it in GitHub Desktop.
fix mysql ubuntu
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
sudo add-apt-repository 'deb http://archive.ubuntu.com/ubuntu trusty universe' | |
sudo apt-get update | |
sudo apt install mysql-server-5.6 * see note below if you get an error | |
sudo apt install mysql-client-5.6 | |
#### | |
sudo add-apt-repository 'deb http://archive.ubuntu.com/ubuntu trusty universe' | |
sudo apt-get update | |
sudo apt-get install mysql-server-5.6 mysql-client-5.6 | |
sudo update-rc.d mysql defaults | |
This is the cli to do this: | |
#Stop mysql: | |
$ sudo service mysql stop | |
$ sudo mysqld_safe --skip-grant-tables | |
Now you can log in as root without a password and perform all commands, as in this case, set the root password as root. | |
sudo mysql --user=root mysql | |
ó | |
mysql -u root | |
use mysql | |
#This is the set root password that you will perform inside mysql if you have MySQL 5.6 or below: | |
mysql> update user set Password=PASSWORD('new-password') where user='root'; | |
update user set Password=PASSWORD('pass') where user='root'; | |
flush privileges; | |
#In MySQL 5.7 or above | |
mysql> update user set authentication_string=PASSWORD('new-password') where user='root'; | |
flush privileges; | |
#From there, quit (kill the running msqld) mysql and start it as normal. | |
#Notes on starting and stopping the mysql service: | |
Stop mysql: | |
$ sudo service mysql stop | |
#Start mysql (normal): | |
$ sudo service mysql start | |
#Kill the temporary mysql safe mode session: | |
$ sudo killall mysqld |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment