【问题标题】:Access denied for myusername via CLI通过 CLI 拒绝 myusername 的访问
【发布时间】:2014-10-03 10:46:20
【问题描述】:

我正在尝试通过命令行创建数据库。这是我输入的:

$ mysql
mysql> CREATE DATABASE my_db;

ERROR 1044 (42000): Access denied for user ''@'localhost' to database 'my_db'

看了ERROR 1044 (42000): Access denied for 'root' With All Privilegesmysql logging in as different user的建议后,我跑了

$ mysql -u myusername -p
ENTER PASSWORD: 
ERROR 1045 (28000): Access denied for user 'myusername'@'localhost' (using password: YES)

怎么了?

【问题讨论】:

标签: mysql


【解决方案1】:

也许更具体的问题应该是:如何在 MySQL 上切换用户?

一旦你有granted the necessary rights to myusername(使用mysql root帐户),你可以exit and then re-enter the mysql shell

mysql --user=user_name --password=your_password db_name

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-11-24
    • 1970-01-01
    • 2019-03-04
    • 2021-04-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多