After installing mysql, centos7 can’t start the service, and prompts unit not found

Phenomenon:

Start MySQL database prompt:

Failed to start mysqld.service: Unit not found

MySQL is no longer supported in centos7. Even if you have installed it, centos7 still says it’s disgusting

 

 

Solutions

Maria dB, an open source version of MySQL

(Maria DB is like the shadow version of MySQL. Maria DB is a branch version of MySQL, not a folk version. The functions provided by Maria dB are fully compatible with MySQL.)

1. Installation:

yum install -y mariadb-server

2.start maria DB serves:

systemctl start mariadb.service

(Note: since CentOS 7. X, CentOS has started to use SYSTEMd service instead of daemon, and the original commands related to the start-up and management of system services are all replaced by systemctl commands.)

3. Add to boot auto start:

systemctl enable mariadb.service

Initialize database configuration

mysql_secure_installation

The first step is to set the password. You will be prompted to enter the password first

Set password

Enter current password for root (enter for none):<– Direct return

Set root password?[ Y/n] <– Whether to set the root password, enter y and press enter or press enter directly
new password: & lt; — Set the password of the root user
re enter new password: & lt; — Enter the password you set again
for other configurations

Remove anonymous users?[ Y/n] <– Do you want to delete anonymous users?Y enter

Disallow root login remotely?[ Y/n] <– Do you want to disable root remote login?N enter

Remove test database and access to it?[ Y/n] <– Delete test database, y enter

Reload privilege tables now?[ Y/n] <– Do you want to reload the permission table?Y enter

Complete the initialization of MariaDB, and then test the local login

Location of configuration file: VIM/etc/my.cnf.d/mysql-clients.cnf

Turn on remote access

Log in to the database locally and execute the following command:

First of all, configure the users who are allowed to access, and give the users permission in the way of authorization

GRANTALLPRIVILEGESON*.*TO'root'@'%'IDENTIFIEDBY'123456'WITHGRANTOPTION;

Finally, after configuring the permissions, you should not forget to refresh them to make them take effect. Note: root is the user who logs in to the database, 123456 is the password for logging in to the database, * means that any host from any source has great permissions anyway

flushprivileges;

Similar Posts: