First, the system environment
The system version after the Yum update upgrade is
[[email protected] yl] #
Second, MySQL installation
Generally, the information given on the Internet is
# Yum install MySQL # Yum Install Mysql-server # Yum Install Mysql-devel
Both MySQL and Mysql-devel were installed successfully, but the installation Mysql-server failed with the following:
[[email protected] yl] # Yum Install Mysql-server from** * updates:mirrors.sina.cnNo package MySQL-server Available. Error:nothing to do
The data found that the CentOS 7 version removed the MySQL database software from the default program list and replaced it with MARIADB.
There are two ways to solve this problem:
1, method one: Install MARIADB
MARIADB database management System is a branch of MySQL, mainly by the open source community in the maintenance, the use of GPL license. One of the reasons for developing this branch is that after Oracle acquired MySQL, there is a potential risk of shutting MySQL out of the source, so the community uses a branching approach to avoid this risk. MARIADB is designed to be fully compatible with MySQL, including APIs and command lines, making it easy to be a replacement for MySQL.
Install MARIADB, size M.
[[email protected] yl] #
The relevant commands for the MARIADB database are:
Systemctl Start mariadb #启动MariaDB
Systemctl Stop mariadb #停止MariaDB
Systemctl Restart MARIADB #重启MariaDB
Systemctl Enable MARIADB #设置开机启动
So start the database first
[[email protected] yl] # systemctl start mariadb
And then you can use MySQL as usual.
[[email protected] yl]#mysql-u root-pEnter Password:welcome to the MariaDB Monitor. Commands End With; or\g.your MariaDB Connection ID is3Server Version:5.5.41-MariaDB MariaDB servercopyright (c)+, Oracle, MariaDB Corporation Ab andothers. Type'Help ;' or '\h' forHelp. Type'\c'To clear the current input statement. MariaDB [(none)]>show databases;+--------------------+| Database |+--------------------+| Information_schema | | MySQL | | Performance_schema | | Test |+--------------------+4 rowsinchSet (0.00sec) MariaDB [(none)]>
After installing MariaDB is also MariaDB [(None)]> , may seem a bit unaccustomed. Here is the second method.
2, Method two: official website download installs Mysql-server
# 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
Restart the MySQL service after the installation is successful.
# Service mysqld Restart
The initial installation of the Mysql,root account has no password.
[[email protected] yl]#mysql-u RootWelcome to the MySQL Monitor. Commands End With;or\g.your MySQL Connection ID is3Server Version:5.6.26MySQL Community Server (GPL) Copyright (c)$, Oracle and/orIts affiliates. All rights reserved. Oracle isA registered trademark of Oracle Corporation and/oritsaffiliates. Other names trademarks of their respectiveowners. Type'Help ;' or '\h' forHelp. Type'\c'To clear the current input statement.mysql>show databases;+--------------------+| Database |+--------------------+| Information_schema | | MySQL | | Performance_schema | | Test |+--------------------+4 rowsinchSet (0.01sec) MySQL>
Set Password
for ' Root '@'localhost' =password ('password'); Query OK, 0 rows affected (0.00 sec) MySQL
You do not need to restart the database to take effect.
During the MySQL installation process, the following content:
Installed:
mysql-community-client.x86_64 0:5.6.26-2.el7 mysql-community-devel.x86_64 0:5.6.26-2.el7
mysql-community-libs.x86_64 0:5.6.26-2.el7 mysql-community-server.x86_64 0:5.6.26-2.el7
Dependency installed:
Mysql-community-common.x86_64 0:5.6.26-2.EL7
Replaced:
mariadb.x86_64 1:5.5.41-2.el7_0 mariadb-devel.x86_64 1:5.5.41-2.el7_0 mariadb-libs.x86_64 1:5.5.41-2.el7_0
Mariadb-server.x86_64 1:5.5.41-2.el7_0
So after installation mariadb automatically replaced, will no longer take effect.
[[email protected] yl] # Rpm-qa |grep mariadb [[email protected] yl] #
Third, configuration mysql1, encoding
MySQL config file is/etc/my.cnf
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.
2. Remote connection Settings
Assign all permissions for all tables in all databases to the root user at all IP addresses.
Mysql> Grant all privileges on * * to [email protected]'%'password ';
If you are a new user and not root, create a new user first
' username '@'%'password';
The remote connection is now available.
The author starof, because the knowledge itself in the change, the author is also constantly learning and growth, the content of the article is not updated regularly, in order to avoid misleading readers, convenient tracing, please reprint annotated source: http://www.cnblogs.com/starof/p/4680083. HTML has a problem welcome to discuss with me, common progress.
CENTOS7 MySQL database installation and configuration