MySQL服务的启动service mysqld start
进入MySQLmysql
退出MySQLexit 或者 \q
初次登录并设置密码
$ mysql u root
mysql> SET password=PASSWORD( password );
再次登录命令mysql u root p
查询用户密码select user host password from mysqluser;
更改密码
> UPDATE user SET password=PASSWORD( new password ) WHERE user=user name;
> FLUSH PRIVILEGES;
> QUIT
更改密码二
> SET PASSWORD FOR user name=PASSWORD(new password);
> QUIT