Jump to content

PHP and MySQL question


Recommended Posts

I can't seem to connect my database to my PHP file since it keeps coming up as an access denied.

 

An example script I have is:

 

<?php
$mysqli = new mysqli("localhost", "states_username", "[what the password is]", "states_test");
$sql="SELECT 1+1";
$result = mysqli_query($mysqli,$sql);
?>

 

 

When I run it, I get: "

Warning: mysqli::mysqli(): (HY000/1044): Access denied for user 'states_username'@'localhost' to database 'states_test' in /home/states/public_html/[redacted].php on line 2

Warning: mysqli_query(): Couldn't fetch mysqli in /home/states/public_html/[redacted].php on line 4

"

Link to comment
Share on other sites

The same page where you create the user's should have another form to assign users to the database. When you do, it'll ask for permissions (if you don't know, use the grant all option at the top, or select all of them).

Link to comment
Share on other sites

Go to https://johnny.heliohost.org:2083/frontend/paper_lantern/sql/index.html and scroll down to where it allows you to add a user to a database. Select the user, and select the database you want to grant them permission to access. When you click submit it will take you to the list of permissions you can grant on that user for that database such as select, delete, update, insert, etc.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...