C:\mysql\bin>mysql -uroot Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 81 to server version: 4.0.21-ntType 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql>use mysql; Database changed mysql>set password for 'root'@'localhost' = password('123456'); //设置root密码 Query OK, 0 rows affected (0.08 sec) //或者直接更新密码 mysql>update user set password=password('123456') where user='root' and host='localhost'; mysql>\q //退出 C:\mysql\bin>net stop mysql && net start mysql //重启Mysql服务
改成:
<?php
$link=mysql_connect('localhost','mm','mm');
if(!$link) echo "fail";
else echo "success";
mysql_close();
?>
还是和上面一样出错..
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 81 to server version: 4.0.21-ntType 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql>use mysql;
Database changed
mysql>set password for 'root'@'localhost' = password('123456'); //设置root密码
Query OK, 0 rows affected (0.08 sec)
//或者直接更新密码
mysql>update user set password=password('123456') where user='root' and host='localhost';
mysql>\q //退出
C:\mysql\bin>net stop mysql && net start mysql //重启Mysql服务