Re: MySQL access denied for user
On 2016-08-15, Bill Wohler <wohler@newt.com> wrote:
> I'm getting the following:
>
> $ mysql -h localhost -u user
> Enter password:
> ERROR 1045 (28000): Access denied for user 'user'@'localhost' (using password: YES)
>
> This user was created with a fresh installation of mysql as (mysql) root
> with the following:
>
> mysql> create user 'user'@'localhost' identified by 'password';
> Query OK, 0 rows affected (0.00 sec)
> mysql> GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER, CREATE TEMPORARY TABLES ON database.* TO 'user'@'localhost' IDENTIFIED BY 'password' with grant option;
> Query OK, 0 rows affected (0.00 sec)
>
> I'm trying to create a database user for Drupal, but am not having any
> luck. Help for a MySQL newb is very much appreciated.
>
> This is on jessie with MySQL 5.5.
>
Try this:
$ mysql -h localhost -u user -p db_name
The '-p' indicates that you wish to be prompted for the password and
db_name is the name of the database you wish to connect to.
The choice of 'user' as your username might be problematic in some
circumstances since that is a reserved word in SQL.
--
Liam
Reply to: