HOW TO UNINSTALL MYSQL AND REINSTALL:
sudo apt-get remove --purge mysql*
sudo apt-get purge mysql*
sudo apt-get autoremove
sudo apt-get autoclean
sudo apt-get remove dbconfig-mysql
sudo apt-get dist-upgrade
sudo apt-get install mysql-server
============================
HOW TO CHANGE MYSQL ROOT PASSWORD-
$sudo apt install mysql-server
After installing mysql if you will not get GUI option to put root user name and password than by default you will get the below user to login ;
Type-
$ sudo cat /etc/mysql/debian.cnf
Example-
mdeka@master:~$ sudo cat /etc/mysql/debian.cnf
# Automatically generated for Debian scripts. DO NOT TOUCH!
[client]
host = localhost
user = debian-sys-maint
password = 5Ge6hlZwxM0IYJBZ
socket = /var/run/mysqld/mysqld.sock
[mysql_upgrade]
host = localhost
user = debian-sys-maint
password = 5Ge6hlZwxM0IYJBZ
socket = /var/run/mysqld/mysqld.sock
----
Here below is the credential-
mysql -u debian-sys-maint -p
Enter password: 5Ge6hlZwxM0IYJBZ
Now -
CHANGE YOUR MYSQL ROOT PASSWORD
-----------
sudo cat /etc/mysql/debian.cnf
You can simply reset the root password by running the server with --skip-grant-tables and logging in without a password by running the following as root or with sudo:
service mysql stop
mysqld_safe --skip-grant-tables &
mysql -u root
---
or login with mysql -u debian-sys-maint -p and do the below steps-
mysql> use mysql;
mysql> update user set authentication_string=PASSWORD("YOUR-NEW-ROOT-PASSWORD") where User='root';
mysql> flush privileges;
mysql> quit
# service mysql stop
# service mysql start
$ mysql -u root -p
Enter Password .......
:) enjoy
No comments:
Post a Comment