Mysql和Putty - ERROR 1044(42000):拒绝用户访问

时间:2022-07-02 20:24:56

Im fairly new at mysql at command line level. unfortunately the assignment i have been set means i have to use command line. I am accessing the schools server via PuTTY. log on no problems them type mysql -p, log in fine but then when i go to create the database i get the 1044 error. i have also tried root but no luck either.

我在命令行级别的mysql相当新。不幸的是,我已经设置的任务意味着我必须使用命令行。我通过PuTTY访问学校服务器。登录没有问题他们输入mysql -p,登录正常然后当我去创建数据库时我得到1044错误。我也试过root但也没有运气。

login as: 10081552
Using keyboard-interactive authentication.
Password:
Last login: Sat Dec  7 16:04:24 GMT 2013 from 90.218.202.89 on ssh
Last login: Sat Dec  7 16:04:29 2013 from 90.218.202.89
10081552@sots ~ $ mysql -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 8636
Server version: 5.0.90-log Gentoo Linux mysql-5.0.90-r2

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> create database hello;
 ERROR 1044 (42000): Access denied for user '10081552'@'localhost' to database 'hello'
mysql>

I checked the privileges and they seem fine (i think)

我检查了特权,看起来很好(我认为)

mysql> show grants;

| Grants for 10081552@localhost                                                                                                            

 GRANT USAGE ON *.* TO '10081552'@'localhost' IDENTIFIED BY PASSWORD '*removed the  hash'                     |
| GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, LOCK TABLES ON `10081552`.* TO '10081552'@'localhost' |

2 rows in set (0.00 sec)

mysql>

so I am sure its something I am doing wrong but can anyone tell me why I am unable to create anything. as I said early I am new to command line but not mysql or databases in general.

所以我确定我做错了但是有人可以告诉我为什么我无法创造任何东西。正如我早期所说,我是新手,但一般不是mysql或数据库。

2 个解决方案

#1


2  

I checked the privileges and they seem fine

我检查了特权,看起来很好

The privileges are not fine for what you're trying to do. GRANTs for your user 10081552@localhost clearly show that it has these privileges only in a database named 10081552

对于您正在尝试的操作,特权并不合适。您的用户的GRANT 10081552 @ localhost清楚地显示它仅在名为10081552的数据库中具有这些权限

GRANT ... ON `10081552`.* TO '10081552'@'localhost' 
             ^^^^^^^^^^^^

Therefore you can successfully create tables in that particular database e.g.

因此,您可以在该特定数据库中成功创建表,例如

CREATE TABLE hello_world(id INT); 

But you're not allowed to create new databases.

但是你不能创建新的数据库。

#2


0  

To create a databases you must use the root username and password

要创建数据库,您必须使用root用户名和密码

#1


2  

I checked the privileges and they seem fine

我检查了特权,看起来很好

The privileges are not fine for what you're trying to do. GRANTs for your user 10081552@localhost clearly show that it has these privileges only in a database named 10081552

对于您正在尝试的操作,特权并不合适。您的用户的GRANT 10081552 @ localhost清楚地显示它仅在名为10081552的数据库中具有这些权限

GRANT ... ON `10081552`.* TO '10081552'@'localhost' 
             ^^^^^^^^^^^^

Therefore you can successfully create tables in that particular database e.g.

因此,您可以在该特定数据库中成功创建表,例如

CREATE TABLE hello_world(id INT); 

But you're not allowed to create new databases.

但是你不能创建新的数据库。

#2


0  

To create a databases you must use the root username and password

要创建数据库,您必须使用root用户名和密码