cmd命令行切换到MySQLbin目录下,
mysqld --skip_grant_tables;//跳过权限验证。
登录mysql后
mysql -u root -p; //mysql首次登录默认密码为空。
方法一:
mysql>updatemysql.user set authentication_string=password('root') where user='root';
mysql> flushprivileges;
mysql> quit;
方法二:
登录mysql后,
mysql>alteruser 'root'@'localhost' identified by 'root';
方法三:
登录mysql后
mysql>setpassword for 'root'@'localhost'=password('root');