MySQL 用户登录密码和远程登录权限问题
1.mysql数据库,忘记root用户登录密码。
解决如下:
a.重置密码
#/etc/init.d/mysqld stop
#mysqld_safe --user=mysql --skip-grant-tables --skip-networking &
#mysql -u root mysql
mysql> UPDATE user SET Password=PASSWORD('newpassword') where USER='root';
mysql> FLUSH PRIVILEGES;
mysql> quit;
b.使用新密码登录
#mysql -u root -pnewpassword
2.远程登录权限
mysql> GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'%' IDENTIFIED BY 'mypassword' WITH GRANT OPTION;
mysql> FLUSH PRIVILEGES;
上面授权是允许myuser用户,从任何机器都能访问mysql服务器。
%代表任何客户端,也可以是localhost,或者是某一ip地址。
相关推荐
lpfvip00 2020-10-07
emmm00 2020-11-17
王艺强 2020-11-17
aydh 2020-11-12
世樹 2020-11-11
zry 2020-11-11
URML 2020-11-11
spurity 2020-11-10
yifangs 2020-10-13
Andrea0 2020-09-18
Ida 2020-09-16
ltd00 2020-09-12
tufeiax 2020-09-03
xjd0 2020-09-10
greatboylc 2020-09-10
adsadadaddadasda 2020-09-08
疯狂老司机 2020-09-08
CoderToy 2020-11-16
ribavnu 2020-11-16