D
D
dake12312016-03-10 07:06:55
MySQL
dake1231, 2016-03-10 07:06:55

How to login from console to mysql if no password has been set?

Hello! How to login in terminal to mysql if no password has been set.
I do this:
mysql -u root -p
and at the invitation to enter the password, just enter. Answer:

Access denied for user 'root'@'localhost' (using password: NO)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Immortal_pony, 2016-03-10
@dake1231

# kill the running mysql process
sudo service mysql stop

# start mysql in safe mode and skip grant tables 
sudo mysqld_safe --skip-grant-tables --skip-networking &

# log in with root 
mysql -u root

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question