1 centeos7 installation mariadb
yum -y install mariadb mariadb-server
2 Start mariadb service
systemctl start mariadb.service
systemctl enable mariadb.service
3 Configuration
Execution mysql_secure_installation
1 first prompted for a password:
Enter current password for root (enter for none): <- Enter the first time directly run
2 Set Password
Set root password [Y / n] <- whether to set the root password, enter y and press Enter, or just press Enter?
New password: <- set the root password
Re-enter new password: <- Re-enter your settings password
New password: <- set the root password
Re-enter new password: <- Re-enter your settings password
Other configurations 3
? Remove anonymous users [Y / n ] <- whether to remove the anonymous user, enter
Disallow root login remotely [Y / n ] <-? Whether to prohibit root remote login, enter,
the Remove the Test Database and Access to IT [the Y-/? n] <- whether to delete the test database, enter
reload privilege tables now [Y / n ] <-? whether to reload the privilege table, enter
Disallow root login remotely [Y / n ] <-? Whether to prohibit root remote login, enter,
the Remove the Test Database and Access to IT [the Y-/? n] <- whether to delete the test database, enter
reload privilege tables now [Y / n ] <-? whether to reload the privilege table, enter
After the configuration, run mysql -uroot -ppassword test login. Where root is the user name to log in, password for the root user's password just set
If you need to open the remote root login is first used for experimental and other environmental ssh access to the database
mysql -uroot -ppassword
use mysql;
select host, user, password from user; <- See table has no record of such an
| ::1 | root |
If there is the recording directly
update user set host='%' where host='::1';
flush privileges;
You can open the root remote login (NA production environment)
If there is no such record is executed
grant all privileges on *.* to root@'%' identified by "password";
flush privileges;