states Posted April 23, 2018 Posted April 23, 2018 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 2Warning: mysqli_query(): Couldn't fetch mysqli in /home/states/public_html/[redacted].php on line 4"
wolstech Posted April 23, 2018 Posted April 23, 2018 Did you assign that user to that database and give it permissions?
states Posted April 23, 2018 Author Posted April 23, 2018 I'm not sure how to check that? I created usernames inside the "MySQL® Databases" page. Honestly, I'm a novice, and I'm sorry for wasting your guys' time.
wolstech Posted April 23, 2018 Posted April 23, 2018 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).
states Posted April 24, 2018 Author Posted April 24, 2018 (edited) I don't see any permissions sections anywhere, even if I create a new user? Inside "PHPMyAdmin", I don't have either a permissions or users tab either Edited April 24, 2018 by states
Krydos Posted April 24, 2018 Posted April 24, 2018 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.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now