Devine Posted July 27, 2007 Share Posted July 27, 2007 I was trying to use a mysql query "create database" and it said: Access denied for user 'ppl'@'localhost' to database 'ppl_beta' Any idea why? (There is a mysql connect usage as well, so i dont know what the problem is..) Quote Link to comment Share on other sites More sharing options...
clanstyles Posted July 27, 2007 Share Posted July 27, 2007 Let me take a shot in the dark, you don't have access to it... Quote Link to comment Share on other sites More sharing options...
Devine Posted July 27, 2007 Author Share Posted July 27, 2007 Let me take a shot in the dark, you don't have access to it... Well no kidding, I want to know how I can get access to it. It is my user (ppl), my database, and I want to create another database on my index.php file. Quote Link to comment Share on other sites More sharing options...
Foser Posted July 27, 2007 Share Posted July 27, 2007 phpmyadmin in there check all users and passwords. Some might have higher priviledges than others use the user and password of the higher up. If you don't have access to this, then you shouldn't make a database at that place. Quote Link to comment Share on other sites More sharing options...
dbair Posted July 27, 2007 Share Posted July 27, 2007 make sure the user (ppl) has permissions set in the mysql.users table. Quote Link to comment Share on other sites More sharing options...
Devine Posted July 27, 2007 Author Share Posted July 27, 2007 $link = mysql_connect('localhost', 'ppl', 'PASSWORD'); if (!$link) { die('Could not connect: ' . mysql_error()); } $sql = 'CREATE DATABASE ppl_'.$post_userid; if (mysql_query($sql, $link)) { echo "Database ppl_$post_userid created successfully\n"; } else { echo 'Error creating database: ' . mysql_error() . "\n"; } This is the code, and I'm connecting via host connect I presume.... What shall I change? Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted July 27, 2007 Share Posted July 27, 2007 Do you only get that error message when run a query with CREATE DATABASE. If that's the case then the ppl user doesn't have sufficient privileges for creating databases and tables and thus you are getting that error message. There is nothing you can do within your code to change your privileges or to override this. You will have to login to mysql using root (or any other user that has sufficient privileges to change another user's privileges) to grant CREATE Privileges for the ppl user. Quote Link to comment Share on other sites More sharing options...
Devine Posted July 27, 2007 Author Share Posted July 27, 2007 Do you only get that error message when run a query with CREATE DATABASE. If that's the case then the ppl user doesn't have sufficient privileges for creating databases and tables and thus you are getting that error message. There is nothing you can do within your code to change your privileges or to override this. You will have to login to mysql using root (or any other user that has sufficient privileges to change another user's privileges). user privileges for a mysql user? or the web host user? (ppl is a web host user) and I tried with a mysql user and it gave the same message (I gave it all of the possible privileges) Quote Link to comment Share on other sites More sharing options...
Devine Posted July 27, 2007 Author Share Posted July 27, 2007 Help? :/ Quote Link to comment Share on other sites More sharing options...
Devine Posted July 27, 2007 Author Share Posted July 27, 2007 Hello? Quote Link to comment Share on other sites More sharing options...
Aureole Posted July 27, 2007 Share Posted July 27, 2007 Login to Cpanel then go to MYSQL then tick the box for all permissions then there shouldn't be a problem... Quote Link to comment Share on other sites More sharing options...
dewey_witt Posted July 27, 2007 Share Posted July 27, 2007 at the mysql query promt type mysql chmod 777? (but this will leave you a lil naked.) Quote Link to comment Share on other sites More sharing options...
per1os Posted July 27, 2007 Share Posted July 27, 2007 If you are using shared hosting, alot of times you are only allowed a certain number of database, and they usually block the create database command. Chances are, that is the problem, unless you say differently. Quote Link to comment Share on other sites More sharing options...
Devine Posted July 28, 2007 Author Share Posted July 28, 2007 If you are using shared hosting, alot of times you are only allowed a certain number of database, and they usually block the create database command. Chances are, that is the problem, unless you say differently. My limit is about 9999, lol ... so I'm sure having 2 database's doesnt make it exceed that.. Login to Cpanel then go to MYSQL then tick the box for all permissions then there shouldn't be a problem... Where in cPanel? Quote Link to comment Share on other sites More sharing options...
teng84 Posted July 28, 2007 Share Posted July 28, 2007 try if the select statement will run because maybe the privilege is limited Let me take a shot in the dark, you don't have access to it... by the way this is the coolest answer i saw in this forum lol you will kill everybody in that answer Quote Link to comment Share on other sites More sharing options...
Devine Posted July 28, 2007 Author Share Posted July 28, 2007 try if the select statement will run because maybe the privilege is limited Let me take a shot in the dark, you don't have access to it... by the way this is the coolest answer i saw in this forum lol you will kill everybody in that answer I can't really use a "select" statement when the database isn't created yet, now can I? Quote Link to comment Share on other sites More sharing options...
teng84 Posted July 28, 2007 Share Posted July 28, 2007 first have you tried running the query in your db say if your using the PHPMYADMIN or any if the query still dont run then im pretty sure that it wont allow you to to create but you can only do some select etc. Quote Link to comment Share on other sites More sharing options...
Devine Posted July 28, 2007 Author Share Posted July 28, 2007 It won't allow me to create my database in phpMyAdmin either... I presume its a limit of privileges with the host? Quote Link to comment Share on other sites More sharing options...
teng84 Posted July 28, 2007 Share Posted July 28, 2007 yup i guess? so now i guess you have to contact the db admin Quote Link to comment Share on other sites More sharing options...
Devine Posted July 28, 2007 Author Share Posted July 28, 2007 Well what he told me was "you have to set your mysql connect to your host user, not your database user".. but that didn't work either... :/ Quote Link to comment Share on other sites More sharing options...
teng84 Posted July 28, 2007 Share Posted July 28, 2007 i you cant create in phpmyadmin then much more in php script i guess what the admin is telling you have to use the pword for host user not for regular user now if thats still not working hhmmm i guess tell them to create db for you lol Quote Link to comment Share on other sites More sharing options...
Devine Posted July 28, 2007 Author Share Posted July 28, 2007 I have no problem creating databases in the cPanel.. Its that I just want to get the db to be created when I state it (in php) 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.