Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

mysql is prompting for password even though my password is empty

Tags:

mysql

I installed mysql on ubuntu server and did not specify password. When I do

mysql -u root -p  

it prompts for password and without providing any input I just hit enter and it works.

Now I need to perform some operation on the database using cron job. My cron job does not work because mysql prompts for a password. I tried doing

mysql -u root -p'' my_database 

but that did not work either.

Any suggestion?

like image 632
Nick Vanderbilt Avatar asked Oct 02 '10 01:10

Nick Vanderbilt


People also ask

Why does MySQL not accept my password?

Recover MySQL root passwordStart the MySQL (mysqld) server/daemon process with the --skip-grant-tables option so that it will not prompt for a password. Connect to the MySQL server as the root user. Set a new root password. Exit and restart the MySQL server.

How do I reset MySQL credentials?

In the mysql client, tell the server to reload the grant tables so that account-management statements work: mysql> FLUSH PRIVILEGES; Then change the 'root'@'localhost' account password. Replace the password with the password that you want to use.

How do I find MySQL default password?

The default user for MySQL is root and by default it has no password.


1 Answers

Go like this mysql -u root --password="" dbname

like image 107
sneilan Avatar answered Sep 20 '22 13:09

sneilan