phpadmin文件夹下的config.inc.php中修改
$cfg['Servers'][$i]['host'] = 'localhost';
$cfg['Servers'][$i]['host'] = '127.0.0.1';
$cfg['Servers'][$i]['nopassword'] = false;
$cfg['Servers'][$i]['AllowNoPassword'] = false;
都设置为true:
$cfg['Servers'][$i]['nopassword'] = true;
$cfg['Servers'][$i]['AllowNoPassword'] = true;
和
$cfg['Servers'][$i]['password'] = '';
需要修改密码解决此问题
首先 关掉mysql服务
再在Terminal执行如下: 进入到文件夹内, 跳过验证, 自动重启mysql服务. 再进入到mysql命令
cd /usr/local/mysql/bin/
./mysqld_safe --skip-grant-tables &
/usr/local/mysql/bin/mysql
mysql> update mysql.user set password=password('root') where user='root';
mysql> flush privileges
mysql> quit
如果运行修改密码是出现错误:
ERROR 1054 (42S22): Unknown column 'password' in 'field list'
说明mysql数据库下已经没有password这个字段了,password字段改成了authentication_string
所以上面的改为:
mysql> update mysql.user set authentication_string=password('root') where user='root';
mysql> flush privileges;
mysql> quit
./mysqld_safe &
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
./mysqladmin -u root -p password
先输入旧密码,再输入两次新密码就可以了