Mysql problem Summary

Today, the test environment need to use mysql database; so I use yum install way to quickly deploy a mariadb. The system used is Linux versions CentOS 7.x. After installation, I naturally using the mysql command the landing, because the environment is just the initial installation, the results being given: 

1 [root@node ~]# mysql
2 ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
Solution: Cancel the authorization form
[root@node ~]# systemctl stop mariadb.service
[root@node ~]# mysqld_safe --user=mysql --skip-grant-tables --skip-networking &
[root @ the Node ~] # mysql_secure_installation set a password in order to initialize the settings and so on

 change Password:

root@nginx:~# mysqladmin -u root -pcentos password "redhat"  
Or modified in the database
MariaDB [mysql]> UPDATE user SET PASSWORD=PASSWORD('redhat') where USER='root';
MariaDB [mysql]> FLUSH PRIVILEGES;
MariaDB [mysql]> QUIT

 

Guess you like

Origin www.cnblogs.com/petersonx/p/11019415.html