a) All delete the system comes with the mysql/mariadb
MySQL is no longer included in the CentOS 7 source, but instead MariaDB; Using Rpm-qa | grep MariaDB searches for MariaDB existing packages. Using Rpm-qa | grep MySQL Search
MySQL Existing package: If present, use Rpm-e–nodeps mariadb-,rpm-e–nodeps mysql all delete: use Rpm-qa | grep Mariadb,rpm-qa | grep MySQL Search Mariadb,mysql again
Existing packages: If present, use Yum remove mysql-* | Yum Remove mariadb-* all delete; use yum List installed | grep MySQL or yum list installed | grep mariadb
If present, use Yum remove mysql-* | Yum Remove mariadb-* all delete; II) Add mariadb yum Source to create/etc/yum.repos.d/mariadb.repo:
VI +/ETC/YUM.REPOS.D/MARIADB.REPO Add the yum source, which is added as shown in the figure:
# MariaDB 10.1 CentOS repository list-created 2016-03-03 13:06 UTC
#http://mariadb.org/mariadb/repositories/
[ MARIADB]
name = mariadb
BaseURL = http://yum.mariadb.org/10.1/centos7-amd64
gpgkey=https:// YUM.MARIADB.ORG/RPM-GPG-KEY-MARIADB
gpgcheck=1
——————————————— Download Address
https://downloads.mariadb.org/mariadb/repositories/#mirror =opencas&distro=centos&distro_release= centos7-amd64–centos7&version=10.1 three) installation MariaDB
Run the Yum install mariadb-server mariadb-client command installation MariaDB
or sudo yum install mariadb-server mariadb-client IV) Start, configure MariaDB start the MariaDB service using the service MySQL start command and then run mysql_s Ecure_installation Configuration mariadb:
Configuration options: y n n N y five) log in to MariaDB and create the appropriate database user and database using mysql-u root-p login, enter the password after entering. Note that the password is not echoed; Create a new user, creating the "user ' paac ' @ ' localhost ' identified by
' Password '; Where password fill in the password you set. Of course, can be modified later; VI) Use the new user to connect to the database execution mysql-u paac-p Enter the password, fill in the password to create the user settings before you can log in to execute the corresponding command, set up the storage engine, create a database, set user rights;
Create a database
create DATABASE paac DEFAULT CHARACTER SET utf8; user paac; CREATE table user (id int (11 ) primary key, username varchar (n) not NULL, password varchar (+) NOT null) default CharSet = UTF8;