CentOS7 installing MySQL with Yum

Source: Internet
Author: User
Tags anonymous mysql client mysql in

First CentOS7 already does not support MySQL, because charges you understand, so the internal integration of MARIADB, and install MySQL will and mariadb file conflict, so need to uninstall MARIADB, the following is uninstall MARIADB, install MySQL steps.

#列出所有被安装的rpm Package
Rpm-qa | grep mariadb

#卸载
Rpm-e mariadb-libs-5.5.37-1.el7_0.x86_64
Error: Dependency detection failed:
libmysqlclient.so.18 () (64bit) was (installed) postfix-2:2.10.1-6.el7.x86_64 required
libmysqlclient.so.18 (libmysqlclient_18) (64bit) was (installed) postfix-2:2.10.1-6.el7.x86_64 needed

#强制卸载, because there is no--nodeps
RPM-E--nodeps mariadb-libs-5.5.37-1.el7_0.x86_64

#安装mysql依赖
Yum Install vim Libaio net-tools

Other information:

1, CentOS under the Mysql-server without a direct installation package;
MARIADB is a branch of MySQL community development and an enhanced alternative;

2, Installation mariadb
Yum-y Install Mariadb-server mariadb mariadb-devel
Systemctl Start mariadb
Systemctl Enable MARIADB
Mysql_secure_installation
Firewall-cmd--permanent--add-service MySQL
Systemctl Restart Firewalld.service
Iptables-l-n|grep 3306

In order to log into MariaDB to secure it, we'll need the CurrentPassword for the root user.  If you ' ve just installed MariaDB, Andyou Haven ' t set the root password yet, the password would be a blank,so you should just Press ENTER here. Enter current password to root (enter for none): ERROR 1045 (28000): Access denied for user ' root ' @ ' localhost ' (using pas Sword:yes)

Here you can set the MySQL password

Setting The root password ensures that nobody can log into the Mariadbroot user without the proper authorisation. Set root Password? [y/n] Ynew Password:re-enter New Password:password updated successfully! Reloading privilege tables. ... success!  By default, a MariaDB installation had an anonymous user, allowing Anyoneto log into MariaDB without had to had a user  Account created Forthem.  This was intended only for testing, and the Installationgo a bit smoother. You should remove them before moving into aproduction environment. Remove anonymous users? [y/n] Y... success!  Normally, Root should only is allowed to connect from ' localhost '. Thisensures that someone cannot guess at the root of password from the network. Disallow Root login remotely? [y/n] n ... skipping.  By default, the MariaDB comes with a database named ' Test ' anyone canaccess. This was also intended only for testing, and should was removedbefore moving into a production environment. Remove Test Database and Accessto it? [y/n] Y-dropping Test Database ... success! -Removing privileges on test database ... success! Reloading the privilege tables would ensure that all changes made so farwill take effect immediately. Reload privilege tables now? [y/n] Y... success! Cleaning up ...  All done! If you've completed all of the above steps, your mariadbinstallation should now is secure. Thanks for using mariadb!

Follow the above settings and note that remote login here is set to N.

1. Download the MySQL repo source

$ wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm

2. Install the MYSQL-COMMUNITY-RELEASE-EL7-5.NOARCH.RPM package

$ sudo rpm-ivh mysql-community-release-el7-5.noarch.rpm

After installing this package, you will get two MySQL yum repo Source:/etc/yum.repos.d/mysql-community.repo,/etc/yum.repos.d/mysql-community-source.repo.

3. Install MySQL

$ sudo yum install Mysql-server

Follow the steps to install it.

[Email protected] ~]#/usr/bin/mysql-u root-penter password:welcome to the MySQL monitor.  Commands End With; or \g.your MySQL connection ID is 11

Enter the setup password above

After entering the MySQL client, show databases;

To start the MySQL service:

1. Start with service: Service mysqld start
2. Start with mysqld script:/etc/inint.d/mysqld start

Persistent startup of MySQL cd/usr/bin/,

PM2 start MySQL

[PM2] Starting/usr/bin/mysql in Fork_mode (1 instance)

[PM2] Done .

┌──────────┬────┬──────┬───────┬────────┬─────────┬────────┬─────┬───────────┬──────┬───── ─────┐

App name ID mode pid   status restart uptime CPU Mem       user watching

├──────────┼────┼──────┼───────┼────────┼─────────┼────────┼─────┼───────────┼──────┼──────────┤

app │1 │ fork │< span class= "s2" > 2330  │ online │ 0       │ 95m     │ 0%  │ 37.3 MB   │ root │ disabled │

app │3 │ fork │< span class= "s2" > 3498  │ online │ 0       │ 82m     │ 0%  │ 25.2 MB   │ root │ disabled │

MONGO │0 │ fork │ 2104 │ online │ 0 │< c17> 104m │ 0% │ 11.5 MB │ root │ disabled │

MySQL │5  │ Fork │ 11449 │ online │ 0       │ 0s     │ 0%  │ 2.0 mb     │ root │ disabled │

└──────────┴────┴──────┴───────┴────────┴─────────┴────────┴─────┴───────────┴──────┴──────────┘

Use the ' PM2 show <id|name> ' to get more details on an app

CentOS7 installing MySQL with Yum

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.