Posts

Showing posts with the label MySQL

How to reset the MySql root password

 How to reset the MySql root password The command line of this article is for the MySQL 8 or higher version. I have tested these commands on Ubuntu 20.04 LTS. Commands may work on other Ubuntu versions too. So, First, we need to check the version of your MySQL. Check the MySql version mysql --version Execute the following command to Stop the MySQL server (We need to stop the MySQL in order to change the password) sudo systemctl stop mysql.service You can apply the following command to check whether the MySQL server stopped or not sudo systemctl status mysql.service Enter ctrl+C to return to the command prompt Now start  MySQL server manually without permission networking checks and set “MYSQLD_OPTS” environment variable  sudo systemctl set-environment MYSQLD_OPTS="--skip-networking --skip-grant-tables" Start the MySQL service sudo systemctl start mysql.service You can apply the following command to check whether the MySQL server started or not sudo systemctl status mysql.ser

Easy Way to Reset MYSQL Root Password for Linux User

 Easy Way to Reset MYSQL Root Password for Linux User Stop the MySQL service, Run the following command for Ubuntu and Debian Users  sudo /etc/init.d/mysql stop For CentOS, Fedora, and Red Hat Enterprise Linux Users sudo /etc/init.d/mysqld stop Now Start MySQL without a password Run the following command sudo mysqld_safe --skip-grant-tables & Connect to MySQL mysql -uroot Set a new MySQL root password use mysql; update user set password=PASSWORD(" yournewpassword ") where User='root'; flush privileges; quit Run the following command to Stop and start the MySQL service For Ubuntu and Debian Users  sudo /etc/init.d/mysql stop sudo /etc/init.d/mysql start For CentOS, Fedora, and Red Hat Enterprise Linux Users sudo /etc/init.d/mysqld stop sudo /etc/init.d/mysqld start Refer:  https://www.librarianvijender.com/2022/12/easy-way-to-reset-mysql-root-password.html

Total views