简体   繁体   中英

mysql command line access denied error 1045

I am trying to access mysql from the command line with:

    mysql -u root --password password

but I get

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

Why is it saying that I'm not using a password?

I use the following syntax:

mysql -h [host] -u [user] -p[password]

Notice that there's no space between the -p and the [password]

The correct syntax for what you're typing is:

 mysql -h [host] -u [user] --password=[password] 

(Check reference manual... it's section 4.5.1 for version 5.5)

If you're working on the same computer where MySQL is installed, you can skip the -h [host] piece, or type -h localhost .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM