Connect to database, got access denied error code 1045 - php

I am learning php now. I got a database information from my supervisor. But I have no idea how to use it. I am trying to access database to create some forms for my php.
all I have: Database Host, Database Name, Database User, Database password.
I was trying to connect to that host by ssh.
shell> ssh username#database host
Then, I logged into server. And, I tried:
shell> mysql -h databasehost -u username -p
then, I inputed database password.
I got a Access Denied Error.
ERROR 1045 (28000): Access denied for user 'vincent.ma'#'localhost' (using password: NO)
I have no idea how it works.
How can I use my database?

Related

How can i get my mysql login and password?

I'm on a mac and am using Mamp.
I 'm just trying to connect to my database through the function mysqli_connect().
But it says:
Access denied for user 'root'#'localhost' (using password: YES)
I have no idea whatsoever on how to retrieve my login and my password. I've read some posts and apparently it's on a php file: etc/phpmyadmin/config.inc.php but I cannot find it.
Thanks.
Default user and password for MAMP is root. Or, you can use your own password by change it manually by run this on Terminal :
/Applications/MAMP/Library/bin/mysqladmin -u root -p password NEWPASSWORD

#1045 - Access denied for user 'a7178301_Burea'#'localhost' (using password: YES)

actually i am just hosting php myadmin server.i am entering my credientiality that is correct then also it give this error. i don't know any thing about php. i have just created account at 000webhost and then in action i have followed through GOTOCVPANEL after in database phpmyadmin . created password and entering it after 2 minute then also this happen. please guide me .
Welcome to phpMyAdmin 2.11.4
Error 1045 - Access denied for user 'a7178301_Burea'#'localhost' (using password: YES)
Language Info
This is because you are using "localhost" to connect.
The name of the database is that appears in your control panel.
ex: mysql15.000webhost.com
check this:
http://www.000webhost.com/forum/web-programming/31247-access-denied-user-username-localhost-using-password-yes.html

What's wrong with this MySQL connection?

I have setup a MySQL database and I am trying to connect to it from another website.
I get this error when I try to connect to it:
Connection failed: Access denied for user 'myUsername'#'localhost' (using password: YES)
It works fine when I do it in the same website where the database is hosted.
I tried this SQL query:
GRANT SELECT, DELETE, UPDATE ON database.myDatabaseName TO 'myUsername'#'localhost' IDENTIFIED BY 'myPassword';
But I got this error:
#1142 - SELECT,UPDATE,DE command denied to user 'Steve'#'localhost' for table 'myDatabaseName'
I went to the MySQL management in the built-in control panel where I modified permissions of Steve and added the Grant permission, however I still get the same #1142 error.
How can I fix this?
Thanks in advance.
Access denied for user 'myUsername'#'localhost' (using password: YES)
That's where the error is. It says you are attempting to connect to localhost with the username myUsername and a supplied password. However, usually on localhost, especially on windows systems, the user is Root and the password is not set, just an empty string. Check your username on your localhost and your password.

Not able to access mysql using script

I am getting the following error when trying to access a MySQL table :
Access denied for user 'root'#'localhost' (using password: NO)
But, I can login with root when using mysql in the command line.
That is the normal behaviour. You set a root password for your database so from now on you can't access it without password. That is why it reports:
Access denied for user 'root#localhost' (using password: no )
Obviously when you give the password with the -p switch you succeed.
You should set up a password for root!
http://dev.mysql.com/doc/refman/5.1/en/resetting-permissions.html

Getting a PDO error when connecting

So I'm working on my PDO skills and so far progress isn't so good. So here's the code corresponding to my issue.
$handler = new PDO('mysql:host=localhost;dbname=s', 'root', '*');
That's basically my connection to my database. Now here's the error I get
SQLSTATE[HY000] [1045] Access denied for user 'root'#'localhost' (using password: YES)
I'm not sure why my access is being denied since the credentials are 100% correct. I've also tested that through the GUI for the database and was able to sign in successfully. Any ideas? I've also tried variables in the username and password section, but it didn't work nor does 127.0.0.1. I'm on localhost on a Mac. Suggestions?
I've got same problems recently, what helped me was reseting my mysql root password:
First, login to user using mysql console:
mysql -u root -p[password]
(no space between -p and your password.
Then, type in command:
UPDATE user SET password=PASSWORD('newpassword') WHERE user='root';

Categories