bash: mysqld_safe: command not found
- 停止mysql运行:
sudo systemctl stop mysqld
- 设置免密登录:
sudo systemctl set-environment MYSQLD_OPTS="--skip-grant-tables"
sudo systemctl start mysqld
mysql -u root
- 将root密码修改为‘password’
GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED BY 'password' WITH GRANT OPTION;