简体   繁体   中英

Mysql and Putty - ERROR 1044 (42000): Access denied for user

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.

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.

I checked the privileges and they seem fine

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

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

Therefore you can successfully create tables in that particular database eg

CREATE TABLE hello_world(id INT); 

But you're not allowed to create new databases.

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

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