at first Mysql had no problem ( can access db via mySql command line with my password) but when i run my php file with wamp server ,i receive this Error :
Access denied for user 'root'#'localhost' (using password: YES)"
.... and after that , not only that my php file raise an error , i get an access denied error trying to access my databases with mySql shell .
i ran these php file with xamp and had no problem , but after switching to wamp all these errors appear , any ideas ?
You need to set a new root password within your WAMP environment. It has a different instance of MySQL to the one in XAMPP, so it won't pick up the same root password. Change the root password and try connecting again, that should work.
Related
I'm currently making a simple app using Laravel and Xampp. While trying to connect the database and make migrations I got this error message from php artisan:
PHP error
So I decided to configure the database manually from the MySQL MariaDB shell (having started the session as the root user), but regardless of what user I try to gran privileges to on any database I get the following error:
MariaDB error
The only possible reason I can come up with is the fact that there seems to be two different root user listed, but I don't thisnk this is the root of the problem, since I'm starting the shell as root, and not choosing one of these after starting.
User List
I've already triple-checked my root user password (I've been starting the shell with this command mysql -u root -p -h 127.0.0.1). Trying to do this through the PHP MyAdmin interface yields the same error.
I'd appreciate any insights, thank you!
The multiple entries for 'root' are specifying which host addresses are allowed connections from (127.0.0.1 and % respectively)
Your error appears to be because your configured database connection (in Laravel) is using the user 'usario'. Search your files for where usario is defined and input the proper credentials to connect to your database in its place.
This is a common error when credentias supplied to MySQL/MariaDB are simply invalid. Bad username, bad password, or both. In this instance it looks as though you're trying to run a migration with a user that doesn't exist.
I am trying use this guys code: https://github.com/daveismynamecom/loginregister in a xampp enviroment. My first error was a connection error. It was easy to solve and just had to cahnge the connection PDO in the config file. Now I get a
SQLSTATE[HY000] [1045] Access denied for user 'database username'#'localhost' (using password: YES)
error. I have looked at every stack q&a and have not found an answer. I didnt change the code from this guys website other than the PDO. any help would be great. Also this was my first time install xampp and I didnt have msql or php before this
[edit] I have never used mysql so how would you set up root permissions and setup a root user. I can log in to the root user from the mysql console by leaving the password blank but I don't know if that is it
[edit v2] I needed to add the user :). Did not know that. but now I am getting a error code 1044 but that is a question for another time
It's not about the code itself - that error comes directly from your MySQL server. Check whether your credentials (user/pass) are correct.
[edited]
I have never used mysql so how would you set up root permissions and setup a root user. I can log in to the root user from the mysql console by leaving the password blank but I don't know if that is it
So did you set a blank password in the config file as well?
I want to build a website on Ubuntu 14.
I have apache, PHP and Mysql installed on it.
I'm using PHP to connect to Mysql but got the error information as follows:
Connection Failed: SQLSTATE[28000][1045] Access denied for user 'root'#'localhost'
Anyone know how to fix it?
Probabbly Wrong Password issue or you didn't set the password for root yet. Try login from terminal using mysql -u root -p and it will asking your current root password.
If you are running a website, do not using root access for your website user access. Create an account with access to specified database.
I'm trying to simply run php artisan migrate --seed on a new Laravel project but everytime I try, I get the error:
SQLSTATE[HY000] [1045] Access denied for user 'appuser'#'localhost' (using password: YES)
I check my database config file and the correct username and password for the database are there.
I check MySQL Workbench, and the correct user is there with all the schema privileges for the same password.
I tried adding the user with privileges under %, localhost and 127.0.0.1 but same access denied error.
I ran a quick check to make sure Laravel was selecting the right environment for the database connection details and it is.
I've created users hundreds of times and never had this problem. This all started after I updated to the latest MySQL Workbench 6.1.7 after the older version stopped working correctly on Windows 8. Sadly, I don't have the option to even go back and test if the old version fixes the problem since it won't work at all.
At this point I can't get any new database users to connect.
The database server is up and running, and every other previously existing user still connects just fine.
Here is the my.ini file.
Any ideas? I'm hoping I'm just tired and missing something obvious here.
by reading the config file.
[client]
password = mysql
port = 3306
socket = "{$path}/mysql/mysql.sock"
i think you need to comment the string with default password. Probaby it affects something.
I have recent MariaDB, and the password string is commented out in every config file example
So I have mySQL installed on Ubuntu and I'm trying to access it with PHP.
As long as I'm in Ubuntu, I can access mySQL from the command line without any issues. However, with PHP, I can only connect to mySQL. Once in, though, it refuses to let me select a database. I've enabled all permissions to the user alias that I'm connecting with, and even allowed remote access to the database.
As root, PHP shows the following error:
(1049) Unknown database 'my_database'
As the user alias I use (called 'default'), PHP shows a different error:
(1044) Access denied for user 'default'#'localhost' to database 'my_database'
What am I missing? This never happened until I upgraded to Ubuntu 10.11.
Grant your user privileges to that database with the correct password:
GRANT ALL PRIVILEGES ON my_database.* TO default#localhost IDENTIFIED BY 'thepassword'