1. service mysqld stop
2. mysqld_safe --skip-grant-tables &
3. if error comes then create mkdir -p /var/run/mysqld and then give permission chown mysql:mysql /var/run/mysqld
and then again run 2 step
4. mysql
5. UPDATE mysql.user SET authentication_string=PASSWORD("password") WHERE User='root';
6. FLUSH PRIVIlEGES;
7. quit
8. then stop mysqld_safe command
9. service mysqld start
Category: mysql
Mysql query description
How to Reset mysql root password without known old password For Debian and Ubuntu
1. service mysql stop
2. mysqld_safe --skip-grant-tables &
3. if error comes then create mkdir -p /var/run/mysqld and then give permission chown mysql:mysql /var/run/mysqld
and then again run 2 step
4. mysql
5. UPDATE mysql.user SET authentication_string=PASSWORD("password") WHERE User='root';
6. FLUSH PRIVIlEGES;
7. quit
8. then stop mysqld_safe command
9. service mysql start
Sql query (Update a column value, replacing part of a string)
UPDATE your_table_name SET `column_name` = REPLACE(`column_name`, 'CurrentString', 'To_replace_String');
Set Mysql root Password In ubuntu 18
sudo mysql
UPDATE mysql.user SET plugin="mysql_native_password" WHERE User='root';
UPDATE mysql.user SET authentication_string=PASSWORD("password") WHERE User='root';
FLUSH PRIVIlEGES;
quit
sudo service mysql restart