Ask Your Question

How can I set mysql root password in a new installation?

asked 2016-10-24 07:34:35 -0500

giordano80 gravatar image

updated 2016-10-25 06:40:20 -0500

hhlp gravatar image

I've just installed mysql server on Fedora 24 and I tried to secure it by mysql_secure_installation command but a password is required even if I never set a password for root user. I obviously cannot access mysql as a password is required. I downloaded mysql with YUM I know on OS X a temporary password is set but here ? Msql install documentation for Fedora don't speak about a temporary password It seems.

Why it happens? How i can reset/set mysql root password ?

Access without password is not accepted:

[root@localhost ~]# mysql_secure_installation

Securing the MySQL server deployment.

Enter password for user root: 
**Error: Access denied for user 'root'@'localhost' (using password: NO)**
edit retag flag offensive close merge delete


You can login into mysql with no password and then add it like grant all on mysql.* to 'root'@'localhost' identified by 'yourpassword' then do flush privileges be carefull if you forget you password you wont be able to login again. Look at mysql documentation

aeperezt gravatar imageaeperezt ( 2016-10-24 09:51:48 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2016-10-24 13:27:56 -0500

giordano80 gravatar image

updated 2016-10-25 06:39:48 -0500

hhlp gravatar image

thanks for the command but I cannot log in mysql with no password and I cannot use the command :(

[root@localhost ~]# mysql -u root -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

I already tried:

[root@localhost ~]# mysql -u root
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
edit flag offensive delete link more


if you use mysql -u root only?

aeperezt gravatar imageaeperezt ( 2016-10-24 13:30:22 -0500 )edit

Then you have to reset your database follow this step unix section

aeperezt gravatar imageaeperezt ( 2016-10-24 14:30:53 -0500 )edit

Question Tools

1 follower


Asked: 2016-10-24 07:34:35 -0500

Seen: 1,800 times

Last updated: Oct 25 '16