MAC下配置MySQL

修改root 密码

1.关闭mysql
在系统设置中关闭
2.安全模式登录并修改密码

cd /usr/local/mysql/bin/
sudo su
./mysqld_safe --skip-grant-tables & 
./mysql -uroot #root身份登录
use mysql;
update MySQL.user set authentication_string=password('root123456') where user='root';

登录mysql

cd /usr/local/mysql/bin/
sudo su
./mysql -uroot -p

登录密码过期

mysql -uroot -p
Enter password:ERROR 1862 (HY000): Your password has expired. To log in you must change it using a client that supports expired passwords.

上面的错误提示意思是需要用当前版本的客户端登入,因为新用户登入后需要立刻修改密码,否则无法继续后续的工作:

mysql> use mysql
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
mysql> set password = password('abc123456');
Query OK, 0 rows affected, 1 warning (0.00 sec)

解决MySQL中【Cannot load from mysql.proc. The table is probably corrupted】的问题

原因:MySQL升级完成后未对相关数据库执行升级
执行命令

mysql_upgrade -uroot -p

你可能感兴趣的:(MAC下配置MySQL)