Centos Install MYSQL

Source: Internet
Author: User
Tags mysql login

Download MySQL
Download Link:
Http://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.10-linux-glibc2.5-i686.tar.gz

Download FTP to Linux below/usr/local/soft/

Unzip the file
Unzip to/usr/local/, MySQL's home directory is named MySQL
[Email protected] local]# cd/usr/local/soft/
[Email protected] soft]# tar zvxf mysql-5.7.10-linux-glibc2.5-i686.tar.gz-c/usr/local
[Email protected] soft]# CD.
[Email protected] local]# MV Mysql-5.7.10-linux-glibc2.5-i686/mysql

Create the data database file directory
Create the data database file directory under MySQL
[Email protected] local]# mkdir mysql/data

Create MySQL user groups and users
create MySQL user groups and users, and set user groups and users to the MySQL directory
[[email protected] local]# groupadd mysql
[[ Email protected] local]# useradd mysql-g mysql
[[email protected] local]# cd mysql
[[email  Protected] mysql]# pwd
/usr/local/mysql
[[email protected] mysql]# chown-r MySQL.
[[email protected] mysql]# chgrp-r MySQL.

Initialize MySQL
Initialize MySQL and start the MySQL service
[Email protected] mysql]# Cd/usr/local/mysql/bin
[email protected] bin]# Yum install Libaio
Set up the installation process
Loading mirror speeds from cached hostfile
* base:mirrors.opencas.cn
* Extras:mirrors.btte.net
* Updates:mirrors.btte.net
Package libaio-0.3.107-10.el6.i686 is installed and is the latest version
No processing required
[Email protected] bin]#/mysql_install_db--user=mysql--basedir=/usr/local/mysql/--datadir=/usr/local/mysql/data
[Email protected] bin]# Cd/usr/local/mysql/support-files
[[email protected] support-files]#./mysql.server start
Starting MySQL. success!

Log in to MySQL
Log in to MySQL, this version of the latest version of no blank password login, in fact, there is an initial password saved in/root/.mysql_secret This file, with this password for the first time after logging in, and then change the password. So first cat view under the initialization password (randomly, each installation sees a different password):
[Email protected] ~]# Cat/root/.mysql_secret
# Password set for user ' [e-mail protected] ' at 2016-01-09 12:00:28
: 5UL#H6DMCWX

With initialization password: 5UL#H6DMCWX start logging in to MySQL:
[Email protected] ~]# Cd/usr/local/mysql/bin
[Email protected] bin]#./mysql-uroot-p:5ul#h6dmcwx
Mysql>
Show login success, you can perform the MySQL command operation!

Modify MySQL login password
Change the root password of MySQL, the new password is ' Leizm '
Mysql> set Password=password (' Leizm ');
Query OK, 0 rows affected, 1 Warning (0.00 sec)


Setting up MySQL remote access
Set Telnet to MySQL. For security purposes under Linux, the MySQL database service is not allowed to be accessed by a machine other than MySQL native, and therefore requires a re-authorization of root. Convenient remote access.

mysql> use MySQL;
Reading table information for completion of table and column names
Can turn off this feature to get a quicker startup with-a

Database changed
Mysql> select Host,user from User;
+-----------+-----------+
| Host | User |
+-----------+-----------+
| % | Root |
| localhost | Mysql.sys |
| localhost | Root |
+-----------+-----------+
3 Rows in Set (0.00 sec)

Mysql> GRANT All privileges on * * to [e-mail protected] '% ' identified by ' leizm ';
Query OK, 0 rows affected, 1 Warning (0.00 sec)
mysql> flush Privileges;
Query OK, 0 rows Affected (0.00 sec)

The last ' Leizm ' of the authorization statement is the new password for the root user of the MySQL database.

Shutting down the firewall
If the remote connection is not up, it is estimated that there is a firewall problem, close the test:
[[Email protected] mysql]# service iptables stop
Setenforce 0iptables: Set the chain to policy accept:filter [OK]
Iptables: Clear Firewall rule: [OK]
Iptables: Uninstalling module: [OK]
[Email protected] mysql]# Setenforce 0
Setenforce:selinux is disabled

Centos Install MYSQL

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.