php - Can't connect to MySQL through MAMP -


So here is my identity in which my credentials are

  'mysql' = & gt; ; Array ('host' = & gt; '127.0.0.1', 'username' = & gt; 'root', 'password' = & gt; '*', 'db' = & gt; 's') < / Code> 

and actual connection

  try {$ this-> _pdo = new PDF ('mysql: host =' .config :: find ('mysql / host'). '; Dbname =' .conff :: found ('mysql / db'), config :: find ('mysql / Username '), config :: find (' myscill / username ')); } Hold (PDOException $ e) {dead ($ e-> getMessage ()); }  

and I get this error

SQLSTATE [28000] [1045] User denied access to 'root' @ 'localhost' (password) Use: Yes)

But I know that it means that admission is denied, but the credentials are 100% correct. I also tested through the command line and through the workspace < / P>

Are you sure the password is set? What happens if you try to connect via the command line line:

  / applications / mamp / library / bin / mysql-root  
< P> In addition, MAMP has a password for root root . This is not a deep / deep secret. Is * valid in your example?

And in your connector, have you tried to use 127.0.0.1 instead of localhost ? I have noticed that some MySQL installations work with one but do not work with others.

Edit: If you have entered the root password in any way, do not panic! You can still reset it like this. Warning, some people believe that this method of password reset is "risky", but it is usually true for any server in the production server or wild. From MAMP to your desktop, it should be 100% safe.

First of all, close MAMP completely.

Library / bin / mysqld --skip-grant-tables

Once this is done, you can login with a 100% password like this:

< You can reset the root password with this one-liner / applications / mamp / library / bin / mysql-root

:

  Set user password = password ('root') where usage Rta = 'root'; Flush Pvt .; Go out;  

OK, now look for the process to run MySQL daemon with the command skip-grant-tables from the command line like this:

  PS-U [your system username] | Grep "mysqld --skip-grant-tables"  

A list should return with two items: a mysqld & amp; The second thing is that the order you made is something like this:

  502 1759 ttys004 0: 00.11 / application / mmp / library / bin / mysqld --skip-grant-tables 502 1766 ttys004 0 : 00.00 grep mysqld  

OK, so now we know the mysqld with the skip-grant-tables process ID 1759, Go ahead and kill it like this:

  kill 1759  

restart MAMP & amp; Route passwords should now work as expected.


Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

c# - MySQL Parameterized Select Query joining tables issue -