Page 1 of 1

Help with mysql - 2 databases with 1 user

Posted: Fri Oct 03, 2008 1:36 pm
by bensd
I am trying to run a script that needs one user with two databases.

My hosting company have told me that i need to create 2 databases and 1 stand-alone user in my hosting cp, then with phpmyadmin i need to grant access from the 2 databases to the stand-alone user.

I have been reading through the mysql website for ages and trying lots of things that don't seem to be working.

I am sure this would be very easy for someone who knows what they are doing! Is there anyone who could give me step by step instructions, or if they were feeling really generous i can give them access to the cp and they could do it for me!

Thanks in advance.

-Ben

Re: Help with mysql - 2 databases with 1 user

Posted: Fri Oct 03, 2008 2:28 pm
by VladSun
[sql]GRANT ALL ON db1_name.* TO user_name@localhost IDENTIFIED BY 'user_password';[/sql]
[sql]GRANT ALL ON db2_name.* TO user_name@localhost IDENTIFIED BY 'user_password';[/sql]

Re: Help with mysql - 2 databases with 1 user

Posted: Fri Oct 03, 2008 3:05 pm
by bensd
Thanks for the quick reply.

When i try this it comes up with the following error:

Code: Select all

#1046 - No database selected

Re: Help with mysql - 2 databases with 1 user

Posted: Fri Oct 03, 2008 6:14 pm
by VladSun
You should really read the basics of MySQL and SQL ;)
[sql]USE database_name;[/sql]

Re: Help with mysql - 2 databases with 1 user

Posted: Sat Oct 04, 2008 2:31 am
by bensd
Should this be used on the same line as the code above or separetly?

Where would you seggest i read about mysql?

Thanks for your help

Ben