In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly introduces the relevant knowledge of "the method of installation and configuration of centos7 mysql database". The editor shows you the operation process through the actual case, and the operation method is simple, fast and practical. I hope this article "method of installation and configuration of centos7 mysql database" can help you solve the problem.
I. system environment
The system version after yum update upgrade is
[root@yl-web yl] # cat / etc/redhat-release centos linux release 7.1.1503 (core)
II. Mysql installation
Generally speaking, the information given on the Internet is
# yum install mysql#yum install mysql-server#yum install mysql-devel
Installation of both mysql and mysql-devel succeeded, but installation of mysql-server failed, as follows:
[root@yl-web yl] # yum install mysql-serverloaded plugins: fastestmirrorloading mirror speeds from cached hostfile * base: mirrors.sina.cn * extras: mirrors.sina.cn * updates: mirrors.sina.cnno package mysql-server available.error: nothing to do
It was found that the centos 7 version removed the mysql database software from the default program list and replaced it with mariadb.
There are two solutions:
1. Method 1: install mariadb
Mariadb database management system is a branch of mysql, which is mainly maintained by the open source community and licensed by gpl. One of the reasons for developing this branch is that after Oracle acquired mysql, there is a potential risk of shutting down mysql, so the community uses a branching approach to avoid this risk. The goal of mariadb is to be fully compatible with mysql, including api and the command line, making it an easy replacement for mysql.
Install mariadb, size 59 m.
[root@yl-web yl] # yum install mariadb-server mariadb
The relevant commands for the mariadb database are:
Systemctl start mariadb # start mariadbsystemctl stop mariadb # stop mariadbsystemctl restart mariadb # restart mariadbsystemctl enable mariadb # set boot
So start the database first.
[root@yl-web yl] # systemctl start mariadb
Then you can use mysql normally.
[root@yl-web yl] # mysql-u root-penter password: welcome to the mariadb monitor Commands end with; or\ g.your mariadb connection id is 3server version: 5.5.41-mariadb mariadb servercopyright (c) 2000, 2014, oracle, mariadb corporation ab and others.type 'help;' or'\ h' for help. Type'\ c' to clear the current input statement.mariadb [(none)] > show databases;+-+ | database | +-+ | information_schema | | mysql | | performance_schema | | test | +-+ 4 rows in set (0.00 sec) mariadb [(none)] >
After installing mariadb, it also shows mariadb [(none)] >, which may seem a little unaccustomed. Here is the second method.
2. Method 2: download and install mysql-server on the official website
# 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 successful installation.
# service mysqld restart
The initial installation of the mysql,root account does not have a password.
[root@yl-web yl] # mysql-u root welcome to the mysql monitor. Commands end with; or\ g.your mysql connection id is 3server version: 5.6.26 mysql community server (gpl) copyright (c) 2000, 2015, oracle and/or its affiliates. All rights reserved.oracle is a registered trademark of oracle corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.type 'help;' or'\ h' for help. Type'\ c' to clear the current input statement.mysql > show databases;+-+ | database | +-+ | information_schema | | mysql | | performance_schema | | test | +-+ 4 rows in set (0.01 sec) mysql >
Set password
Mysql > set password for 'root'@'localhost' = password (' password'); query ok, 0 rows affected (0.00 sec) mysql >
There is no need to restart the database to take effect.
During the mysql installation process, the following:
Installed: mysql-community-client.x86_64 0rig 5.6.26-2.el7 mysql-community-devel.x86_64 0vir 5.6.26-2.el7 mysql-community-libs.x86_64 0vir 5.6.26-2.el7 mysql-community-server.x86_64 0V 5.6.26-2.el7 dependency installed: mysql-community-common.x86_64 0vir 5.6.26-2.el7 replaced: mariadb.x86_64 1: 5.5.41-2.el7_0 mariadb-devel.x86_64 1VR 5.5.41-2.el7_0 mariadb-libs.x86_64 1VR 5.5.41-2.el7_0 mariadb-server.x86_64 1V 5.5.41-2.el7_0
So after installation, mariadb is automatically replaced and will no longer take effect.
[root@yl-web yl] # rpm-qa | grep mariadb [root@yl-web yl] #
3. Configure mysql
1. Coding
The mysql configuration file is / etc/my.cnf
Finally, add the coding configuration.
[mysql] default-character-set = utf8
The character encoding here must be the same as in / usr/share/mysql/charsets/index.xml.
2. Remote connection settings
Assign all permissions on all tables in all databases to root users at all ip addresses.
Mysql > grant all privileges on *. * to root@'%'identified by 'password'
If it is a new user instead of root, create a new user first
Mysql > create user 'username'@'%' identified by' password'
At this point, you can connect remotely.
This is the end of the introduction to "the method of installing and configuring centos7 mysql database". Thank you for your reading. If you want to know more about the industry, you can follow the industry information channel. The editor will update different knowledge points for you every day.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.