Install MySQL database under Linux (compressed package installation)

Source: Internet
Author: User

1, here I will install MySQL in the/usr/local/mysql directory, can also be installed in other places;

Mkdir/usr/local/mysql
2. Download MySQL compression pack

wget http://dev.MySQL.com/get/Downloads/MySQL-5.7/mysql-5.7.11-Linux-glibc2.5-x86_64.tar.gz

If the command above doesn't work, you can use the command below
Curl-o-L http://dev.MySQL.com/get/Downloads/MySQL-5.7/mysql-5.7.11-Linux-glibc2.5-x86_64.tar.gz
3. Unzip and copy

TAR-XVF mysql-5.7.11-linux-glibc2.5-x86_64.tar.gz
MV mysql-5.7.11-linux-glibc2.5-x86_64/*/usr/local/mysql/
4. Create the Data directory

Mkdir/usr/local/mysql/data
5. Create a MySQL user group and its users

Groupadd MySQL
Useradd-r-G MySQL MySQL
6. Initialize Data

Copy Code
[[email protected] MySQL]./bin/mysql_install_db--user=mysql--basedir=/usr/local/mysql/--datadir=/usr/ local/mysql/data/
2016-01-20 02:47:35 [WARNING] mysql_install_db is deprecated. Consider switching to mysqld--initialize
2016-01-20 02:47:45 [WARNING] The bootstrap log isn ' t empty:
2016-01-20 02:47:45 [WARNING] 2016-01-19t18:47:36.732678z 0 [WARNING]--bootstrap is deprecated. Please consider using--initialize instead
2016-01-19t18:47:36.750527z 0 [Warning] Changed limits:max_open_files:1024 (requested 5000)
2016-01-19t18:47:36.750560z 0 [Warning] Changed limits:table_open_cache:431 (requested 2000)
Copy Code
7. Copy the configuration file to/etc/my.cnf

Cp-a./SUPPORT-FILES/MY-DEFAULT.CNF/ETC/MY.CNF (select y)
8. mysql service scripts are put into the system service

Copy Code
Cp-a./support-files/mysql.server/etc/init.d/mysqld
Modify the My.cnf file

These is commonly set, remove the # and set as required.

Basedir =/usr/local/mysql
DataDir =/usr/local/mysql/data
Port = 3306

server_id = .....

Socket =/tmp/mysql.sock
Character-set-server = UTF8

Remove leading # To set options mainly useful for reporting servers. The server defaults is faster for transactions and fast selects.adjust sizes as needed, experiment to find the optimal VA Lues.join_buffer_size = 128msort_buffer_size = 2mread_rnd_buffer_size = 2M

Copy Code
9. Create in

Ln-s/usr/local/mysql//usr/bin/
10. Start the service

Service mysqld Start
11. Initialize Password

mysql5.7 generates an initialization password in the root. mysql_secret file.

[email protected] ~]# Cat/root/.mysql_secret

Password set for user '[email protected]' At 2017-03-16 00:52:34

ws;fmt7yh0cm
12. Login and Change Password

[email protected] ~]# mysql-u root-p

Alter user [email protected] identified by ' Tiger ';

Flush privileges;
13. Sign out and log in again to complete

Copy Code
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| Information_schema |
| MySQL |
| Performance_schema |
| SYS |
+--------------------+
4 rows in Set (0.11 sec)

Install MySQL database under Linux (compressed package installation)

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.