01记录mysql安装问题
2020-05-14 本文已影响0人
VincentLeon
运行mysql
Starting MySQL
./usr/local/mysql/bin/mysqld_safe: line 647: /usr/local/mysql/data/XXXX-Pro.local.err: Permission denied
Logging to '/usr/local/mysql/data/XXXX-Pro.local.err'.
/usr/local/mysql/bin/mysqld_safe: line 144: /usr/local/mysql/data/XXXX-Pro.local.err: Permission denied
/usr/local/mysql/bin/mysqld_safe: line 198: /usr/local/mysql/data/XXXX-Pro.local.err: Permission denied
/usr/local/mysql/bin/mysqld_safe: line 906: /usr/local/mysql/data/XXXX-Pro.local.err: Permission denied
rm: /usr/local/mysql/data/XXXX-Pro.local.pid.shutdown: Permission denied
/usr/local/mysql/bin/mysqld_safe: line 144: /usr/local/mysql/data/XXXX-Pro.local.err: Permission denied
ERROR! The server quit without updating PID file (/usr/local/mysql/data/XXXX-Pro.local.pid).
cd /usr/local/mysql/data
cd: permission denied: data
sudo chmod -R 777 /usr/local/mysql/data
再次运行
Starting MySQL
.. ERROR! The server quit without updating PID file (/usr/local/mysql/data/XXXX-Pro.local.pid).
cd /usr/local/mysql/data
cat XXXX-Pro.local.err
发现日志里说错误占用3306端口
Do you already have another mysqld server running on port: 3306 ?
ps -ef | grep mysqld
kill -9
忘记初始密码
苹果->系统偏好设置->最下边点mysql 在弹出页面中 关闭mysql服务(点击stop mysql server)
step2:
进入终端输入:cd /usr/local/mysql/bin/
回车后 登录管理员权限 sudo su
回车后输入以下命令来禁止mysql验证功能 ./mysqld_safe --skip-grant-tables &
回车后mysql会自动重启(偏好设置中mysql的状态会变成running)
step3.
输入命令 ./mysql
回车后,输入命令 FLUSH PRIVILEGES;
回车后,输入命令 SET PASSWORD FOR 'root'@'localhost' = PASSWORD('你的新密码');
至此,密码修改完成,可以成功登陆