How do I fix this error: [1045] SQLSTATE[28000] [1045] - mysql

I am working on a server that is not my localhost for the first time. I am renting hosting space from hostgator. I created a form that is supposed to take the user's information and put it in the database. I keep on recieving the following error message when I try to submit the form:
Failed to open database [1045] SQLSTATE[28000] [1045] Access denied
for user 'username#localhost'#'gator7899.hostgator.com' (using
password: YES)
I have seen other posts in which people ask the same question but none of the answers given are working for me. Also, username is not my actual username and gator7899 is not the actual server. For security purposes I did not post them here.
Does anyone know how to fix this?

Make sure privledges are assigned in your CPanel -> mysql admin -> add user to database
then
you need to change your config to be
localhost
username = username of CPanel
password = password of Cpanel

Related

I cant log into phpmyadmin and get an error

I am a bloody beginner when it comes to website building. After I put wordpress per FTP on my hosted domain I need the MySQL Password. Because the databank is build automaticly I need to open the .my.cnf file in phpmyadmin. Now when I try to log into the web interface I get this error:
mysqli::real_connect(): (HY000/1045): Access denied for user 'eisenast.uber.space'#'localhost' (using password: YES)
My googlesearch didnt find anything with the same problem. I tried all the passwords and usernames in different combinations that I had.

Can't connect to MySQL using user with password

I am setting up my local development environment using XAMPP for writing websites using Laravel.
The issue im facing is that I cannot connect to the MySQL database with any new user I create. I give one user limited privileges for only one database and cannot connect using the correct password.
I tried making an admin user with full privileges on all databases and tables, and still cannot connect with the correct password.
The returned error is always the same -
SQLSTATE[HY000] [1045] Access denied for user 'laravel'#'localhost' (using password: YES)
and
ERROR 1045 (28000): Access denied for user 'admin'#'localhost' (using password: YES)
where laravel is the username, admin is the other one etc.
This is not related to Laravel as I keep getting this error even when I try to connect from the command line (as shown in error code number 2).
The 'anonymous' user has been removed to make sure MySQL doesn't match it by mistake, I have flushed privileges and restarted services countless times.
The default root user without password can connect, but no new users that I create with passwords can.
Solved the problem by re-installing XAMPP, nothing else.

MySQL connection help - root user HAS privileges, but is being denied access?

I've been trying to figure this out for a solid 24 hours.
I'm with GoDaddy for hosting. I have installed MySQL Server and Workbench. I've successfully created my root user with a password on my local server.
I'm trying to send form data using post method to a database I've successfully created with Workbench.
When submitting the form, I keep getting the error: ERROR: Could not connect. Access denied for user 'root'#'localhost' (using password: YES)
I've tried creating a new user and granting all privileges to that new user as well, but it still doesn't work. Nothing is working.
What am I doing wrong?

SQLSTATE[28000] [1045] Access denied for user 'root'#'localhost' (using password: YES)

I keep getting this error:
SQLSTATE[28000] [1045] Access denied for user 'root'#'localhost'
(using password: YES)
And I don't know how to fix it.
I have installed MySQL, Apache2, PHP and phpMyAdmin. Then I've changed a few things in the .htaccess file and changed AllowOverride from none to all (not sure where I did this again). That's all I've done with the server. I read people talking about databases, but I've only got 1 DB.
It seems you're attempting to access the database with the root user, without providing the corresponding password.
If you have no idea what the password is, I suggest you attempt to recover it, using this procedure.

Access denied while using XAMPP on OS X Mavericks

Does anyone know why I would be getting an Access Denied error using XAMPP on OS X?
When I go to localhost/phpmyadmin I get the message #1045 - Access denied for user 'root'#'localhost' (using password: YES)
and when I go to just localhost I get
Access forbidden!
You don't have permission to access the requested directory. There is
either no index document or the directory is read-protected.
Is this a permissions issue? I added the password root to the username root in the phpmyadmin config file, but that didn't work and it wouldn't explain why I am getting the error on localhost as well. What IS working is the virtual host I created called my.server, but other than that, I seem to be locked out for some reason.
This error:
#1045 - Access denied for user 'root'#'localhost' (using password: YES)
Is a MySQL error. That's saying that there was an attempt to connect to the MySQL server, and either the specified user account doesn't exist, or the passwords don't match. From another client that can connect, verify the user account exists
SELECT u.user, u.host, u.password
FROM mysql.user
WHERE u.user = 'root'
AND u.host = 'localhost'
If the password column is empty, then there's no password on that account. If there's a '*688D...' value in there, you can compare the value of the hash of the password you're supplying...
SELECT PASSWORD('mysecretpassword')
Also, I'd recommend you create a DIFFERENT database user account (other than 'root'#'localhost', for use by your PHP scripts. (As one advantage, this will allow you to apply the security principle of "least privilege", granting only the privileges required.
The other error is saying that the webserver isn't configured to allow access to the URI you've specified, in the case of "http://localhost/", the webserver isn't configured to allow access to the ROOT of the webserver directory. (This is usually a really a good thing, in terms of security, not exposing the contents of this directory.)