Новости
Документация
Download
Webboard
Поиск
FAQ/ЧаВо
Обратная связь




MySQL.RU - Webboard



Вернуться
ERROR 1045: Access denied for user: 'test' (DarkLord) 03/11/2005 - 11:45:23
      Re: RTFM! (Dinky) 03/11/2005 - 23:42:55
      Re: RTFM! (DarkLord) 11/11/2005 - 10:45:04

> Original message text:
> From: DarkLord - 03/11/2005 - 11:45:23
> Subject:ERROR 1045: Access denied for user: 'test'
> -----------------
> Не получается загрузить данные из файла.
> Захожу пользователем:
> mysql -u book -p bookstore
> Все номально. Команды выполняются, выборки могу делать.
> А загрузить файл не получается:
> mysql> load data infile 'BOOKS' into table Books;
> ERROR 1045: Access denied for user: 'book@localhost' (Using password: NO)
> Пробовал менять права доступа командами GRANT И REVOKE, а
> результата ноль.
> Под root все нормально работает.
> В чем тут грабли?
>
>


From: DarkLord - 11/11/2005 - 10:45:04
Subject:RTFM!
-----------------

Создаю пользователя для базы данных с соотв. правами доступа:
insert into user (host,user,password) values ('localhost','book',password('password'));
insert into db (db,host,user,Select_priv,Insert_priv,Delete_priv,Create_priv,Drop_priv)
-> values ('localhost','bookstore','book','y','y','y','y','y');

Пользователь нормально получает доступ к базе данных, делает выборки,
но нет возможности загрузить данные из файла.

[root]# mysql -u book -p bookstore
Enter password:
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1 to server version: 4.0.20-log

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> show tables
-> ;
+---------------------+
| Tables_in_bookstore |
+---------------------+
| authors |
| books |
| categories |
| publishers |
+---------------------+
4 rows in set (0.00 sec)

mysql> load data infile 'books' into table books fields terminated by '|';
ERROR 1045: Access denied for user: 'book@localhost' (Using password: NO)

Хотя под root все работает.

[root]# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2 to server version: 4.0.20-log

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> use bookstore
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> load data infile 'books' into table books fields terminated by '|';
Query OK, 50 rows affected (0.05 sec)
Records: 50 Deleted: 0 Skipped: 0 Warnings: 197


Смотрю права доступа выставленные в базе данных.
Получается, что пользователь не имеет никаких привилегий. :-(

mysql> use mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> select * from user where User = "book";
+-----------+------+------------------+-------------+-------------+-------------+-------------+-------------+-----------+-------------+---------------+--------------+-----------+------------+-----------------+------------+------------+--------------+------------+-----------------------+------------------+--------------+-----------------+------------------+----------+------------+-------------+--------------+---------------+-------------+-----------------+
| Host | User | Password | Select_priv | Insert_priv | Update_priv | Delete_priv | Create_priv | Drop_priv | Reload_priv | Shutdown_priv | Process_priv | File_priv | Grant_priv | References_priv | Index_priv | Alter_priv | Show_db_priv | Super_priv | Create_tmp_table_priv | Lock_tables_priv | Execute_priv | Repl_slave_priv | Repl_client_priv | ssl_type | ssl_cipher | x509_issuer | x509_subject | max_questions | max_updates | max_connections |
+-----------+------+------------------+-------------+-------------+-------------+-------------+-------------+-----------+-------------+---------------+--------------+-----------+------------+-----------------+------------+------------+--------------+------------+-----------------------+------------------+--------------+-----------------+------------------+----------+------------+-------------+--------------+---------------+-------------+-----------------+
| localhost | book | 02c68e0207f5fd47 | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | | | | | 0 | 0 | 0 |
| % | book | 565491d704013245 | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | | | | | 0 | 0 | 0 |
+-----------+------+------------------+-------------+-------------+-------------+-------------+-------------+-----------+-------------+---------------+--------------+-----------+------------+-----------------+------------+------------+--------------+------------+-----------------------+------------------+--------------+-----------------+------------------+----------+------------+-------------+--------------+---------------+-------------+-----------------+
2 rows in set (0.03 sec)


Пробую создать пользователя со всеми правами доступа на базу bookstore
с помощью команды grant:

mysql> grant all privileges on bookstore.* to book5@localhost identified by 'password' with grant option;
Query OK, 0 rows affected (0.00 sec)

mysql> exit
Bye
[root]# service mysqld restart
Stopping mysqld service: [ DONE ]
Adjusting environment for mysqld: [ DONE ]
Starting safe_mysqld service: [ DONE ]
[root]# mysql -u book5 -p bookstore
Enter password:
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1 to server version: 4.0.20-log

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> load data infile 'books' into table books fields terminated by '|';
ERROR 1045: Access denied for user: 'book5@localhost' (Using password: NO)


[root@]# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2 to server version: 4.0.20-log
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> select * from user where User = "book5";
+-----------+-------+------------------+-------------+-------------+-------------+-------------+-------------+-----------+-------------+---------------+--------------+-----------+------------+-----------------+------------+------------+--------------+------------+-----------------------+------------------+--------------+-----------------+------------------+----------+------------+-------------+--------------+---------------+-------------+-----------------+
| Host | User | Password | Select_priv | Insert_priv | Update_priv | Delete_priv | Create_priv | Drop_priv | Reload_priv | Shutdown_priv | Process_priv | File_priv | Grant_priv | References_priv | Index_priv | Alter_priv | Show_db_priv | Super_priv | Create_tmp_table_priv | Lock_tables_priv | Execute_priv | Repl_slave_priv | Repl_client_priv | ssl_type | ssl_cipher | x509_issuer | x509_subject | max_questions | max_updates | max_connections |
+-----------+-------+------------------+-------------+-------------+-------------+-------------+-------------+-----------+-------------+---------------+--------------+-----------+------------+-----------------+------------+------------+--------------+------------+-----------------------+------------------+--------------+-----------------+------------------+----------+------------+-------------+--------------+---------------+-------------+-----------------+
| localhost | book5 | 02c68e0207f5fd47 | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | | | | | 0 | 0 | 0 |
+-----------+-------+------------------+-------------+-------------+-------------+-------------+-------------+-----------+-------------+---------------+--------------+-----------+------------+-----------------+------------+------------+--------------+------------+-----------------------+------------------+--------------+-----------------+------------------+----------+------------+-------------+--------------+---------------+-------------+-----------------+
1 row in set (0.00 sec)

результат тот же - загружать данные из файла не получается.


P.S. MySQL version 4.0.20
AltLinux 2.4 Master




[Это сообщение - спам!]

Последние сообщения из форума

Уважаемые посетители форума MySQL.RU!
Убедительная просьба, прежде чем задавать свой вопрос в этом форуме, обратите внимание на разделы:
- ответы на наиболее часто задаваемые вопросы - FAQ
- раздел документация
- раздел поиск по сообщениям форума и документации
Также, старайтесь наиболее подробно указывать свою ситуацию (версию операционной системы, версию MySQL, версию программного обеспечения, по которому возникает вопрос, текст возникающих ошибок, и др.)
Помните, чем конкретнее Вы опишете ситуацию, тем больше шансов получить реальную помощь.
 Имя:
 E-mail:
 Тема:
 Текст:
Код подтверждения отправки: Code
25013



РЕКЛАМА НА САЙТЕ
  Создание сайтов | |