While messing around with some of my other sites I ran into a major problem. I had developed a great deal of conent for the main site and thought it would be great to make a seperate site for mobile users. The new site would of course be much smaller and compact but still allow the majority of data from the main site to be viewed.
When I started developing the mobile site hit a brick wall, I could not connect to the database on my main site even though both sites were on the same server. I tried connecting to localhost as well as the IP address, specifying the db name or calling it from the query. Needless to say it tooks hours to figure out what was going on so here is my solution.
Note: These sites are hosted on a MediaTemple DV server which is a virtualized dedicated server run through PLESK. Each domain hosted on the server gets assigned it’s own db.
Log into the SSH terminal and go to your mySQL prompt by using the following command line:
mysql –uadmin –p`cat /etc/psa/.psa.shadow`Your promt should now look like:
mysql>
Once you are in your mySQL prompt you can create a new user(which is what I did) or you can just modify an existing user.
To create a new user, replace your ip below, *** is the password:
CREATE USER 'username'@'255.255.255.255' IDENTIFIED BY '***';Next we need to give prvileges to this user:
GRANT SELECT ,INSERT ,UPDATE ,DELETE ,CREATE ,DROP ,FILE , INDEX ,ALTER, EXECUTE ON * . * TO 'username'@'255.255.255.255' IDENTIFIED BY '***' WITH MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0 ;And finally we need to grant privileges to all the databases on the server:
GRANT ALL PRIVILEGES ON * . * TO 'username'@'255.255.255.255';So now that the user is set up with all the correct privileges we can flush privileges and call this job done:
FLUSH PRIVILEGES;
Notes: Now I know this may not work for everyone and it is a rather generic setup but the above is meant to give you a starting point for opening up permissions accross a server. You will need to modify the above if you want only specific permissions given as well as access to only certain databases.
![[del.icio.us]](http://scriptperfect.com/wp-content/plugins/bookmarkify/delicious.png)
![[Digg]](http://scriptperfect.com/wp-content/plugins/bookmarkify/digg.png)
![[dzone]](http://scriptperfect.com/wp-content/plugins/bookmarkify/dzone.png)
![[Facebook]](http://scriptperfect.com/wp-content/plugins/bookmarkify/facebook.png)
![[Furl]](http://scriptperfect.com/wp-content/plugins/bookmarkify/furl.png)
![[Google]](http://scriptperfect.com/wp-content/plugins/bookmarkify/google.png)
![[LinkedIn]](http://scriptperfect.com/wp-content/plugins/bookmarkify/linkedin.png)
![[MySpace]](http://scriptperfect.com/wp-content/plugins/bookmarkify/myspace.png)
![[Newsvine]](http://scriptperfect.com/wp-content/plugins/bookmarkify/newsvine.png)
![[Propeller]](http://scriptperfect.com/wp-content/plugins/bookmarkify/propeller.png)
![[Reddit]](http://scriptperfect.com/wp-content/plugins/bookmarkify/reddit.png)
![[Slashdot]](http://scriptperfect.com/wp-content/plugins/bookmarkify/slashdot.png)
![[Spurl]](http://scriptperfect.com/wp-content/plugins/bookmarkify/spurl.png)
![[StumbleUpon]](http://scriptperfect.com/wp-content/plugins/bookmarkify/stumbleupon.png)
![[Technorati]](http://scriptperfect.com/wp-content/plugins/bookmarkify/technorati.png)
![[Twitter]](http://scriptperfect.com/wp-content/plugins/bookmarkify/twitter.png)
![[Email]](http://scriptperfect.com/wp-content/plugins/bookmarkify/email.png)