Mysql 修改密码 、创建用户以及允许远程访问

1. 修改密码 用 set password 命令 mysql -u root mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('newpass'); mysqladmin mysqladmin -u root password "newpass" or mysqladmin -u root password oldpass "newpass" update 修改mysql.user 表 mysql -u root mysql> use mysql; mysql> UPDATE user SET Password = PASSWORD('newpass') WHERE user = 'root'; mysql> FLUSH PRIVILEGES; 丢失root密码时 mysqld_safe --skip-grant-tables& …