LAMP刚安装完后,mysql的用户root密码是空的,导致phpmyadmin无法登录,该如何解决呢?
一 安装 lamp-server 与 phpmyamdin
1 2 3
| $ sudo apt install lamp-server^ -y $ sudo apt install phpmyadmin -y $ sudo ln -s /usr/share/phpmyadmin /home/me/mywww
|
二 修改 phpmyadmin配置
1 2 3 4 5 6
| $ cd /usr/share/phpmyadmin/libraries $ vim config.default.php
|
保存后,则phpmyadmin允许空密码登录了。然而用root用户名依然不能登录!!!
四 查原因
1 2 3 4 5 6 7 8 9 10 11 12 13 14
| $ sudo mysql mysql> use mysql mysql> select user,plugin from user; +--------------------+-------------------------+ | user | plugin | +--------------------+-------------------------+ | debian-sys-maint | mysql_native_password | | mysql.infoschema | mysql_native_password | | mysql.session | mysql_native_password | | mysql.sys | mysql_native_password | | phpmyadmin | mysql_native_password | | root | auth_socket | +--------------------+-------------------------+
|
但是可以用phpmyadmin的用户名来登录
修改 root的plugin属性
1 2 3
| mysql> update user SET plugin='mysql_native_password' WHERE user='root'; mysql> flush privileges; mysql> quit;
|
修改 root的密码
1
| mysql> set password for 'root'@'localhost' = password('你设置的密码'
|