Unable to connect to mysql 5.0.8 using mysql_connect with password

I can connect to mysql db using php without password penalty. However, when I add the password to phpmyadmin, I can no longer connect. I get the error in sequence:

"Could not connect: Access denied for user 'admin'@'localhost' (using password: YES)"

I tried using both MySQL password 4.0 and 4.1+ parameters with the same results.

mysql_connect ("127.0.0.1", "admin", "password") or  die('Could not connect: ' . mysql_error());;
mysql_select_db ("datatable");

Does anyone have an idea of ​​what could be happening here?

EDIT: I can access it if I disable the password. There seems to be some misunderstanding

+3
source share
4 answers

This can help

Steps -

  • go to phpmyadmin;
  • click on the database you want to change pw to (left),
  • click "privileges"; A.
  • " " root .
  • " ";
  • "";
  • ;
  • tick:... .
  • "";
  • MySql WAMPSERVER;
  • pw - , ( , , pw, ), :

    UPDATE mysql.user SET Password = PASSWORD ( "xxxxxx" ) WHERE User = "root"; ( xxxxxx - , ).

  • : FLUSH;

  • WAMP MAMP, APPS PHPMYADMIN (, phpmyadmin2.11.6) config.inc.php

  • config.inc.php :

$cfg['Servers'][$i]['password'] = '';

, 3 :

$cfg['Servers'][$i]['password'] = 'yourPasswordHere';

  • config.inc.php

!

- http://www.knowledgesutra.com/discuss/tsilti-php-myadmin-access-mysql-database.html

+1

mysql_connect, , admin@'127.0.0.1'. TCP/IP mysql. admin@localhost, mysqld mysql.sock( ).

SELECT user,host,password FROM mysql.user WHERE user='admin';

admin@localhost. , admin@'127.0.0.1'. , admin@localhost.

:

mysql_connect ("localhost", "admin", "password") or  die('Could not connect: ' . mysql_error());;
mysql_select_db ("datatable");

mysql , mysql .

admin @localhost :

UPDATE mysql.user SET password=password('whateverpassword')
where user='admin' and host='localhost';
DELETE FROM mysql.user WHERE user='';
FLUSH PRIVILEGES;

: admin@127.0.0.1 :

GRANT ALL PRIVILEGES ON *.* TO admin@'127.0.0.1' IDENTIFIED BY 'whateverpassword';

+1

. , , . .

0

MySQL phpMyAdmin,

FLUSH PRIVILEGES

.

0

All Articles