phenomenon:
Start the MySQL database prompt in centOS7:
Failed to start mysqld.service: Unit not found
It's already installed, why doesn't the prompt exist?
the reason:
In CentOS7, mysql is no longer supported, even if you have already installed it, CentOS7 still expresses dislike.
solution:
Install MySQL's new open source version: MariaDB
MariaDB is like a shadow version of MySQL. MariaDB database is a branch version of MySQL, not a derivative version (folk), and it provides functions that are fully compatible with MySQL.
1. First, you need to install mariadb-server
yum install -y mariadb-server
2. Start the service
systemctl start mariadb.service
3. Add to boot
systemctl enable mariadb.service
4. Make some security settings and modify the database administrator password
mysql_secure_installation
5. MySQL opens remote access permissions for root
use mysql;
select User,authentication_string,Host from user;
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456';
flush privileges;
exit;
possible problems:
MariadDB reports an error when starting
Job for mariadb.service failed because the control process exited with error code. See "systemctl status mariadb.service" and "journalctl -xe" for details.
Solution:
[root@cdh01 mysql]# cp /usr/share/mysql/my-huge.cnf /etc/my.cnf
cp: overwrite ‘/etc/my.cnf’? y
[root@cdh01 mysql]# systemctl start mariadb.service