当没有用户名密码时,以root身份登录
mysql -u root mysql>set password for 'root'@'localhost'=password('newpasswd'); mysql>set password for 'root'@'%'=password('newpasswd'); //联网
当没有用户名密码时,以root身份登录
mysql -u root mysql>set password for 'root'@'localhost'=password('newpasswd'); mysql>set password for 'root'@'%'=password('newpasswd'); //联网