Installation Environment:
[Email protected] rookie]# lsb_release-a LSB Version:: Core-4.1-amd64:core-4.1-noarch Distributor Id:centos Description:centos Linux release 7.4.1708 (Core) release:7.4.1708 Codename:core |
Installing the MySQL database
#yum Install Mysql-server #yum Install Mysql-devel #yum install MySQL |
The following error occurred while installing mysql-server :
[email protected] rookie]# Yum install Mysql-server
Loaded Plugins:fastestmirror
Loading mirror speeds from cached hostfile
* base:mirrors.tuna.tsinghua.edu.cn
* Extras:mirrors.btte.net
* Updates:mirrors.btte.net
No Package Mysql-server Available
The information found is The CentOS7 version removes the MySQL database software from the default program list and replaces it with MARIADB .
Workaround:
1, completely uninstall MARIADB
Uninstall MARIADB Database
query for the installed MARIADB components:
[Email protected] rookie]# Rpm-qa | grep maria*
Mariadb-server-5.5.49-1.el7.centos.x86_64
Mariadb-common-5.5.49-1.el7.centos.x86_64
Mariadb-client-5.5.49-1.el7.centos.x86_64
To unload a database:
[Email protected] rookie]# yum-y Remove mari*
To delete a database file:
[Email protected] rookie]# rm-rf/var/lib/mysql/*
2.
official website Download install mysql-server
Download First: # wget http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm # RPM-IVH mysql-community-release-el7-5.noarch.rpm # yum Install Mysql-community-server |
3. Restart the MYSQLD service after installation is complete.
PS: Initial installation mysql,root Account no password
4.
Configure MySQL
MySQL config file is/etc/my.cnf
Encoding Method
Finally add the encoding configuration
[MySQL] Default-character-set=utf8 |
the character encoding here must be consistent with the /usr/share/mysql/charsets/index.xml.
Set Password
Assign all the permissions for all tables in all databases to a value in all The root user of the IP address.
Mysql> Grant all privileges on * * to [e-mail protected] '% ' identified by ' abc123! '; mysql> flush Privileges; |
If you are a new user and not root, create a new user first
Mysql>create user ' username ' @ '% ' identified by ' passwd '; |
CentOS7 installing the MySQL Database