Install MySQL database under Linux

Source: Internet
Author: User
Tags deprecated localhost mysql mysql in

In my hundred tear not his sister case, Baidu to a pro-test useful articles, as follows:

1. Here I install MySQL in the/usr/local/mysql directory, but also can be installed in other places;

Mkdir/usr/local/mysql

2. Download MySQL compression pack

wget http:/ /// If the command above does not work, you can use the command below Curl-o-L http://

3. Unzip and copy

TAR-XVF mysql-5.7.11-linux-glibc2.5-x86_64.tar.gzmv 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

-r-g MySQL MySQL

6. Initializing data

[email protected]localhost 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--Initialize2016-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 instead2016-01-19t18:47:36.750527z 0 [Warning] Changed Limits:max_open_ files:1024 (requested)2016-01-19t18:47:36.750560z 0 [Warning] Changed limits:table_open_cache:431 ( Requested 2000

7. Copy the configuration file to/etc/my.cnf

Cp-a./support-files/my-Default

8.MySQL service scripts placed in system services

Cp-a./support-files/mysql.server/etc/init.d/mysqld Modify MY.CNF File # These is commonly set, remove the # and set as Required.basedir=/usr/local/Mysqldatadir=/usr/local/mysql/dataport= 3306# server_id=... socket=/tmp/Mysql.sockcharacter-set-server =utf8# Remove Leading # To set options mainly useful forreporting servers.# The server defaults is faster fortransactions and fast selects.# Adjust sizes as needed, experiment to find the optimal values.# join_buffer_size =128m# sort_buffer_size=2m# read_rnd_buffer_size= 2M

9. Create in

Ln-s/usr/local/mysql/  /usr/bin/

10. Start the service

11. Initialize Password

~]# cat/root/ for user ' [e-mail protected] ' at 2017-03-16 00:52:34 ws;fmt7yh0cm

12. Log in and change the password

[[email protected] ~]# mysql-u root-' root '; flush privileges;

13. Exit the login again to complete

Mysql> show databases; +--------------------+| Database           |+--------------------+| information_schema | | mysql              | | performance_schema | | sys                |+----------- ---------+4 rows in Set (0.11 sec)

Okay, OK.

Install MySQL database under Linux

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.