ubuntu18.04 mysql5.7/mariadb10.1 set root password
1. Login (use sudo to login without password)
sudo mysql -u root
2. Check
SELECT User,Host FROM mysql.user;
DROP USER 'root'@'localhost';
sudo mysql -u root
2. Check
SELECT User,Host FROM mysql.user;
3. Delete out root user
4. Create new root user
CREATE USER 'root'@'%' IDENTIFIED BY 'your_password';
5. Grant permissions
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION;
6. FLUSH PRIVILEGES;
评论
发表评论