2022-10-28

how to run mysql daemon without password.

Hi,
I few people have come to my office with issues about connecting to the version of mysql they installed. This seems to be mainly an issue if someone installed mysql using brew on a Mac.
 
The first thing to check is if mysql is actually running. On a Mac or Linux you could do this by opening a terminal window and typing:
 ps uax | grep mysql
(psstat) and seeing if you have any mysql process other than one that just issued the grep mysql. If you do, you want to stop the mysql service. Look at the path to mysql, if it contains MAMP/WAMP/XAMPP, then that's version of mysql you have running, you can probably use MAMP/WAMP/XAMPP GUI interface to stop it. If not, a command like:
 brew services stop mysql
   (on Mac, if used brew to install)
or
 service mysqld stop 
  (on linux)
will probably stop mysql. Looking at the output of the grep statement above, you should be able to see the path to the bin folder in which the mysqld executable lives. You now want to run the mysql daemon, but so that it doesn't check login passwords:
 path_to_mysql_bin/mysqld_safe ‐‐skip-grant-tables &
Next from a terminal prompt connect to mysql:
 mysql -u root
Enter the commands:
 use mysql;
 update user set password=PASSWORD("[NEW PASSWORD]") where User='root';
 flush privileges;
 quit
Restart the mysql, you should now be able to connect using the password you set above. I got this info from:
 https://techgenix.com/reset-mysql-root-password-forgotten/
Hope it helps someone.
Best,
Chris
Hi, I few people have come to my office with issues about connecting to the version of mysql they installed. This seems to be mainly an issue if someone installed mysql using brew on a Mac. The first thing to check is if mysql is actually running. On a Mac or Linux you could do this by opening a terminal window and typing: ps uax | grep mysql (psstat) and seeing if you have any mysql process other than one that just issued the grep mysql. If you do, you want to stop the mysql service. Look at the path to mysql, if it contains MAMP/WAMP/XAMPP, then that's version of mysql you have running, you can probably use MAMP/WAMP/XAMPP GUI interface to stop it. If not, a command like: brew services stop mysql (on Mac, if used brew to install) or service mysqld stop (on linux) will probably stop mysql. Looking at the output of the grep statement above, you should be able to see the path to the bin folder in which the mysqld executable lives. You now want to run the mysql daemon, but so that it doesn't check login passwords: path_to_mysql_bin/mysqld_safe ‐‐skip-grant-tables & Next from a terminal prompt connect to mysql: mysql -u root Enter the commands: use mysql; update user set password=PASSWORD("[NEW PASSWORD]") where User='root'; flush privileges; quit Restart the mysql, you should now be able to connect using the password you set above. I got this info from: https://techgenix.com/reset-mysql-root-password-forgotten/ Hope it helps someone. Best, Chris
X