MySQL installation under Linux

Source: Internet
Author: User
Tags iptables

1. Download the installation package
http://dev.mysql.com/downloads/mysql/#downloads
It is recommended to download the TAR package (Http://cdn.mysql.com//Downloads/MySQL-5.7/mysql-5.7.12-linux-glibc2.5-x86_64.tar) for the common installation method.2. See if you have installed MySQL;
[Email protected] desktop]$ Rpm-qa | grep mysqlmysql-libs-5.1.52-1.el6_0.1~]# rpm-e mysql-libs-5.1.52.x86_64--

3. Create MySQL Users and groups

[[Email protected] ~~] #useradd-R-G MySQL MySQL

You can then check to see if you have successfully created

[Email protected] ~]# Cat/etc/group | grep MySQL
[Email protected] ~]# CAT/ETC/PASSWD | grep MySQL4.
4. Extract the tar.gz to the directory you want to installOf course first will be MySQL's. tar.gz package to the corresponding directory, using the WINSCP tool
[Email protected] local]# TAR-ZXVF mysql-5.7.15-linux-glibc2.5-i686.tar.gz

5. After the successful decompression, the file changed to a name

[[Email protected] local]# mv mysql-5.7.15-linux-glibc2.5-i686 MySQL

6. Installing and initializing the database

[Email protected] local]# mysql/bin/mysql_install_db--user=mysql--basedir=/usr/local/mysql/--datadir=/usr/local/ mysql/data/
[[Email protected] local]# CD MySQL

----------------------
If you change the default installation path, you will need to
1) Modification in/ETC/MY.CNF and/etc/init.d/mysqld
Basedir= '/apps/mysql '
Datadir= '/apps/mysql/data '
2) Create Ln
Mkdir-p/usr/local/mysql/bin
Ln-s/apps/mysql/bin/mysqld/usr/local/mysql/bin/mysqld
----------------------
[[email protected] MySQL] #cp-A./support-files/my-default. cnf/etc/my.cnf

Ask if you are covered, yes

[[email protected] local] #cp-A./support-files/mysql.server  /etc/init.d/mysqld
[Email protected] mysql]# CD bin/
[Email protected] bin]#/mysqld_safe--user=mysql &
[1] 1986
[Email protected] bin]# 2016-10-05t16:34:17.548875z mysqld_safe Logging to '/usr/local/mysql/data/ Promote.cache-dns.local.err '.
2016-10-05t16:34:17.629041z Mysqld_safe starting mysqld daemon with databases From/usr/local/mysql/data


[Email protected] bin]#  /etc/init.d/mysqld restartshutting down MySQL . 2016-10-05t16:35:37.679390z mysqld_safe mysqld from PID file/usr/local/mysql/data/promote.cache-dns.local.pid Ended                                                           [  OK  ]starting MySQL.                                            [  OK  ] [1]+  Done                    ./mysqld_safe--user=

Set boot up MySQL

[Email protected] bin]# chkconfig--level mysqld on


7. Initialize Passwordmysql5.7 will generate an initial password to log in to the
[Email protected] bin]# Cat/root/.mysql_secret

Lfu+t9hi+ojn
[Email protected] bin]#./mysql-uroot-p

Welcome to the MySQL Monitor. Commands End With; or \g.
Your MySQL Connection ID is 2
Server version:5.7.15

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

Oracle is a registered trademark of the Oracle Corporation and/or its
Affiliates. Other names trademarks of their respective
Owners.

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

Change Password
mysql> SET PASSWORD = PASSWORD (' 123456 '0 rows affected, 1 Warning (0.00 sec) MySQL>0 rows Affected (0.00 sec)

8. Add Remote access Permissions

mysql> use mysql;mysql > Update user set host = '% ' where user = ' root '; MySQL>/etc/ini T.d/mysqld restart

9. Open Port 3306 (other ports can also be used)


[[email protected] bin]#/sbin/iptables-i input-p TCP--dport 3306-j ACCEPT;
[Email protected] bin]#/etc/init.d/iptables status

MySQL installation under Linux

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.