I got the database created with the "create database [database_name]", but the user, password and permissions doesn't stick; this is where I get it wrong.

Using cPanel, here's the process I follow:

1.) log into cPanel using my hosting account username & password
2.) click MySQL
3.) create database
3.) create user
4.) add user to database with "all" permissions

I'm trying to do the same thing on the command line with PuTTY (a great telenet/ssh client). I'm 80% there.

I just need to figure out the commands to 3 & 4 (from the list above).

I sure appreciate the help...

Comments

jscoble’s picture

I'm assuming you were referring to the second 3, creating the user. Your original post actually has the information you need:

The SQL statement to create a user in MySQL, replace databasename with the name of the database you created. Replace userid with the name of the user you wish to create. Replace password with the password for the user. By issuing the GRANT you are creating the user and giving that user the specified permissions on the database specified. These are the only permissions a Drupal userid should need.

GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX,
ALTER, CREATE TEMPORARY TABLES, LOCK TABLES
ON databasename.*
TO 'userid'@'localhost'
IDENTIFIED BY 'password';

Then execute this statement to tell MySQL to reload the GRANT tables:

FLUSH PRIVILEGES;

If you still cannot login with the userid/password you may need to reset the password:

SET PASSWORD FOR 'userid'@'localhost' = OLD_PASSWORD('password');

Regards,

Joel

Anonymous’s picture

Thanks Joel, Others, for the assistance.

Still not working.... Here's the commands I used:

mysql> grant all privileges on databasename.* to 'userid@localhost' identified by 'password';

Where 'databasename' is the database I created previously, 'userid' is the user I want to create, and 'password' is the password I want to associate with the 'userid'.

Here's the error:

ERROR 1145 (42000): The host or user argument to GRANT is too long

I checked cPanel > MySQL to see if the user was created and it wasn't.

===
Doug Ouverson
hear | see | say | do | teach

mjohnq3’s picture

If you actually typed in: 'userid@localhost' then that's not the correct syntax. It should be: 'userid'@'localhost'. The @ should not be inside the single-quotes.

Anonymous’s picture

Thanks.

===
Doug Ouverson
hear | see | say | do | teach

rgopal’s picture

I can not create new user in database name 'my_database' .

I tried both queries as shown below:

create user 'myuser'@'localhost' identified by 'mypassword';

create user 'myuser'@'my_database' identified by 'mypassword';

I got an error 1396 HY000

Both of them did not work.

Can any body configure it out.

Thanks .

Anonymous’s picture

CREATE DATABASE youraccountname_drupal;

GRANT ALL PRIVILEGES ON youraccountname_drupal.* TO 'your accountname_yourusername'@'localhost' IDENTIFIED BY 'yourpassword';

Of course, the caps aren't required.

Hope that helps.

I've also posted a "10 minute install using PuTTY" Do a search for "10 minute install" and you should find it.

===
Doug Ouverson
hear | see | say | do | teach

rgopal’s picture

Hi Douge,

I tried your query. It worked.
It shows Query Ok, zero rows effected.

But, when I connect to my own database. It did not ask to me enter username and password for login.

I really appreciate.
Thanks.

Anonymous’s picture

What do you mean, "connect to my own database"? Is this an original drupal install?

===
Doug Ouverson
hear | see | say | do | teach