Yesideez Posted April 10, 2009 Share Posted April 10, 2009 In the past I've used cPanel for this but I've just spent about an hour trying to get a user to connect to a database and no luck! I've tried following the instructions in the online MySQL documentation as well as guides online. I've even gone into phpMyAdmin and tried creating users in there manually. All permissions have been set and I still get an error message when trying to connect to the database. Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'testuser'@'localhost' (using password: YES) in C:\wamp\www\test.php on line 2 ERROR: Access denied for user 'testuser'@'localhost' (using password: YES) The one thing I seem to be missing is associating a user to a database once a user has been created and all permissions set. I cannot find out how to do this manually anywhere! Quote Link to comment Share on other sites More sharing options...
Yesideez Posted April 10, 2009 Author Share Posted April 10, 2009 Story of my life... Just as I post a topic asking for help the damn thing decides to work! Quote Link to comment Share on other sites More sharing options...
Yesideez Posted April 10, 2009 Author Share Posted April 10, 2009 OK now it won't work again. I've got a local domain set up called "music.local" which I can access in my browser. The code is there as I get "cannot connect" message as above. I've created the database and imported all the data. When I created the user zeb_music I tried adding it directly in phpMyAdmin and setting permissions below and also via the MySQL console. I've tried: grant all on *.* to zeb_music@localhost; This says it worked but it won't connect. I also tried: grant all on *.* to zeb_music@music.local; Which also said worked but it didn't. I've tried every combination I can think of and lost count the number of times I've restarted all services. All I want to do is create a user and give it access to the database but nothing is working. Quote Link to comment Share on other sites More sharing options...
Yesideez Posted April 10, 2009 Author Share Posted April 10, 2009 Seems I was missing one word out - PRIVILEGES! This I'm finding creates my user and grants access: grant all privileges on *.* to zeb_music@localhost identified by 'password'; What was helping me to get confused was whether I should be using music.local instead of localhost. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.