After we have installed MySQL (mariadb is installed on cnetos 7), we have the following problem, which we can usenetstat -lntupView the port of the following server, and the port of MySQL is generally defaults to
3306,Check to see if the service is started, not started, start it, centos6: service start mysql, centos7: system CTL start MySQL
:
The problem with typing the mysql_secure_install command appears as shown in the following figure. It is also possible that the MySQL service was not turned on, just follow the above method
Entering this command requires setting the password. The first time I set it anyway, I would report a similar error. However, the second time I used the password, I didn’t show the error. Now I don’t know why I couldn’t find the error point.
So in abstract terms, my solution is to add in /etc/my.cnf.
[mysqld]
innodb_file_per_table = on Enable InnoDB storage engine
skip_name_resolve = on Prohibit host name resolution
[mysqld_safe]
default-character-set =utf8
After modification, you need to restart the service systemctl restart MariaDB
(‘root’@’localhost’ The password is empty
‘root’@’%’There is a password)