In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
I. system environment
[root@localhost ~] # cat / etc/redhat-release
CentOS Linux release 7.6.1810 (Core)
II. Mysql installation
# yum install mysql mysql-server mysql-devel
Failed to install mysql-server, as shown below:
[root@localhost ~] # yum install mysql-server
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Base: mirrors.sina.cnextras: mirrors.sina.cnupdates: mirrors.sina.cn
No package mysql-server available.
Error: Nothing to do
This is because CentOS 7 uses mariadb instead of MySQL database software.
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 59m.
[root@localhost ~] # yum install mariadb-server mariadb
The relevant commands for the mariadb database are:
Systemctl start mariadb # launch MariaDB
Systemctl stop mariadb # stop MariaDB
Systemctl restart mariadb # restart MariaDB
Systemctl enable mariadb # set boot up
So start the database first.
[root@localhost ~] # systemctl start mariadb
Then you can use mysql normally.
[root@localhost] # mysql-u root-p
Enter password:
Welcome to the MariaDB monitor. Commands end with; or\ g.
Your MariaDB connection id is 3
Server version: 5.5.41-MariaDB MariaDB Server
Copyright (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
Download mysql:
Wget http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
Source code installation:
Rpm-ivh mysql-community-release-el7-5.noarch.rpm
Installation Services:
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@localhost] # mysql-u root
Welcome to the MySQL monitor. Commands end with; or\ g.
Your MySQL connection id is 3
Server 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 its
Affiliates. Other names may be trademarks of their respective
Owners.
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.01sec)
Mysql >
Set the mysql login 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 0VOR 5.6.26-2.el7 mysql-community-devel.x86_64 0RU 5.6.26-2.el7
Mysql-community-libs.x86_64 0VOR 5.6.26-2.el7 mysql-community-server.x86_64 0RU 5.6.26-2.el7
Dependency Installed:
Mysql-community-common.x86_64 0RO 5.6.26-2.el7
Replaced:
Mariadb.x86_64 1VR 5.5.41-2.el7_0 mariadb-devel.x86_64 1V 5.5.41-2.el7_0 mariadb-libs.x86_64 1V 5.5.41-2.el7_0
Mariadb-server.x86_64 1Rank 5.5.41-2.el7_0
So after installation, mariadb is automatically replaced and will no longer take effect.
[root@localhost ~] # rpm-qa | grep mariadb
[root@localhost ~] #
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.
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.