Installing the MySQL database in RHEL6

Source: Internet
Author: User

What we're going to show you today is the RHEL6 installation in the system MySQL database, this experiment is in VMware implemented in virtual machines.

System version: 2.6.32-71.el6.i686

[Email protected] ~]# uname-a

Linux wuli.redhat.com 2.6.32-71.el6.i686 #1SMP Wed Sep 1 01:26:34 EDT-i686 i686 i386 Gnu/linux

Database version: 5.6.20

[[email protected] downloads]# ls

mysql-client-5.6.20-1.el6.i686.rpm mysql-shared-compat-5.6.20-1.el6.i686.rpm

mysql-server-5.6.20-1.el6.i686.rpm

next start to install the database, if it is downloaded bundled rpm software package, after the decompression will find a lot of packages, where I only install server and client two packages. It is important to note that a RHEL compatibility package, the Shared-compat package, needs to be installed before installation .

[Email protected] downloads]# rpm-ivhmysql-shared-compat-5.6.20-1.el6.i686.rpm

Preparing ... ########################################### [100%]

1:mysql-shared-compat ########################################### [100%]

The default system to install the mysql-libs-5.1.47-4.el6.i686 software package, the direct uninstall will prompt a packet dependency, after the installation of Shared-compat , you can uninstall it off, Failure to do so will affect the installation.

[Email protected] downloads]# rpm-e mysql-libs

Create MySQL System Admin User:

[[email protected] downloads]# groupadd MySQL

[Email protected] downloads]# useradd-g mysqlmysql

[[email protected] downloads]# passwd MySQL

Changing password for user MySQL.

New password:mysql(here the password is set to MySQL)

Bad password:it are too short

Bad Password:is too simple

Retype new password:mysql

Passwd:all Authentication tokens updatedsuccessfully.

[Email protected] downloads]#

Next Install mysql-client-5.6.20-1.el6.i686.rpm and mysql-server-5.6.20-1.el6.i686.rpm two packages.

[Email protected] downloads]# rpm-ivhmysql-server-5.6.20-1.el6.i686.rpm

Preparing ... ########################################### [100%]

1:mysql-server ########################################### [100%]

[Email protected] downloads]# rpm-ivhmysql-client-5.6.20-1.el6.i686.rpm

Preparing ... ###########################################[100%]

1:mysql-client ########################################### [100%]

enabled MySQL Service:

[[email protected] downloads]# service MySQL start

Starting MySQL ....... ..... [ OK ]

[Email protected] downloads]#

The first thing you need to do is get a random password for login, as follows:

[Email protected] downloads]# More/root/.mysql_secret

# The random password set for the root Userat Fri 8 05:18:49 (Local t

IME): Qc1exkep3jtegxzl

[Email protected] downloads]#

sign in with a random password for the first time MySQL Database, and then modify the login password by the following method:

[Email protected] downloads]# mysql-uroot-pQc1exkep3jtegxzl

Warning:using a password on the CommandLine interface can be insecure.

Welcome to the MySQL Monitor. Commands End With; or \g.

Your MySQL Connection ID is 1

Server version:5.6.20

Copyright (c) and/or, Oracle, Itsaffiliates. All rights reserved.

Oracle is a registered trademark of oraclecorporation and/or its

Affiliates. Other names trademarksof their respective

Owners.

Type ' help ', ' or ' \h ' for help. Type ' \c ' toclear the current input statement.

Mysql>

Set the login password to MySQL(this is set to MySQL)

Mysql> set Password=password (' MySQL ');

Query OK, 0 rows affected (0.07 sec)

Mysql> flush Privileges;

Query OK, 0 rows Affected (0.00 sec)

Mysql>

To Modify the installation directory permissions:

[Email protected] downloads]# chown-r mysql:mysql/usr/share/mysql

[Email protected] downloads]# chown-r mysql:mysql/var/lib/mysql

Add environment Variables for MySQL:

[[email protected] ~]# vim. Bash_profile

#. Bash_profile

# Get the aliases and functions

If [-f ~/.BASHRC]; Then

. ~/.bashrc

Fi

# User specific environment and Startupprograms

Path= $PATH: $HOME/bin

Export PATH

Export

Exportdatadir=/var/lib/mysql

Exportmysql_home=/usr/share/mysql

stop starting MySQL:

[Email protected] ~]# mysqladmin-uroot-pshutdown

Enter Password:mysql

[Email protected] ~]#

[Email protected] ~]#/usr/share/mysql/mysql.server start--user=mysql

Starting MySQL. [ OK ]

here the entire installation process has been completed, but we often come to configure or login to the MySQL database, it is not possible to configure each time on the server, many cases will be logged into the server through the terminal, the default mysql The server prohibits logging on to it from other terminals.

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/45/0C/wKiom1PjjbqCSNrPAACaEaFshZ8817.jpg "title=" 1.jpg " alt= "Wkiom1pjjbqcsnrpaacaeafshz8817.jpg"/>

Here's how to fix it:

Log in to the database first

[Email protected] ~]#mysql–uroot–p

Enter Password:mysql

mysql> use mysql

Reading table information for completion oftable and column names

Can turn off this feature to get Aquicker startup with-a

Database changed

mysql> Update user set host= '% ' wherehost= ' localhost ';

Query OK, 1 row affected (0.06 sec)

Rows matched:1 changed:1 warnings:0

Mysql> flush Privileges;

Query OK, 0 rows affected (0.06 sec)

Then we'll come back to the server via the client:

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/45/0D/wKioL1PjjwSA8PFuAAJZJJIitgs438.jpg "title=" 2.jpg " alt= "Wkiol1pjjwsa8pfuaajzjjiitgs438.jpg"/>

Successfully logged in.

If you encounter the following prompt because the server is causing the firewall to open, workaround : turn off the firewall.

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/45/0D/wKioL1PjjyKRvyxIAAEytusaswE857.jpg "title=" 3.jpg " alt= "Wkiol1pjjykrvyxiaaeytusaswe857.jpg"/>

We can view the installed database version:

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/45/0C/wKiom1PjjinBaY7QAAB5DI8ECqY934.jpg "title=" 4.jpg " alt= "Wkiom1pjjinbay7qaab5di8ecqy934.jpg"/>

Here , the whole experiment is complete, welcome to MySQL 's World ^_^!


This article is from "Wuli Echnical's blog," Please make sure to keep this source http://wuli03960405.blog.51cto.com/1470785/1537201

Related Article

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.