Help with mysql - 2 databases with 1 user

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
bensd
Forum Newbie
Posts: 5
Joined: Fri Oct 03, 2008 1:35 pm

Help with mysql - 2 databases with 1 user

Post 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
User avatar
VladSun
DevNet Master
Posts: 4313
Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria

Re: Help with mysql - 2 databases with 1 user

Post 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]
There are 10 types of people in this world, those who understand binary and those who don't
bensd
Forum Newbie
Posts: 5
Joined: Fri Oct 03, 2008 1:35 pm

Re: Help with mysql - 2 databases with 1 user

Post 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
User avatar
VladSun
DevNet Master
Posts: 4313
Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria

Re: Help with mysql - 2 databases with 1 user

Post by VladSun »

You should really read the basics of MySQL and SQL ;)
[sql]USE database_name;[/sql]
There are 10 types of people in this world, those who understand binary and those who don't
bensd
Forum Newbie
Posts: 5
Joined: Fri Oct 03, 2008 1:35 pm

Re: Help with mysql - 2 databases with 1 user

Post 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
Post Reply