Home > front end >  Can't run mysql commands as root linux user
Can't run mysql commands as root linux user

Time:12-01

As linux root user:

root@local:~# mysql

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

I'm confused. Shouldn't the root user be able to run mysql without additional authentication? How do I fix this?

CodePudding user response:

Your root account in MySql has a password. Try this

mysql -p

and enter the password you, or somebody set.

If that doesn't work try

mysql -h localhost -u root -p

It that doesn't work you'll need to reset your MySql root password. That's the topic of several tutorials on the 'toobz

CodePudding user response:

If the MySQL root user has a password, using the default authentication plugin, then you must provide a password to connect, full stop. You can configure an account with no password, but that's a habit you should avoid.

You can provide a password by any of the following means:

There's also a way to provide a password through environment variables, but that's discouraged now because it's really not secure.

  • Related