Linux installation MySQL

Source: Internet
Author: User

Linux installation MySQL

--@ Beam WP

Summary: Linux installs MySQL.

First, download MySQL

1, in Baidu Search MySQL, see one of the results is with MySQL downloads words, click into the website of MySQL.

    

2, after entering the MySQL official website, can see the MySQL Community Edition (GPL) below, click the link below, will enter the download list.

    

3, find MySQL Community Server in the download list, click the link below, will go to the product selection page.

    

4. Select the appropriate operating system, then select a suitable version (. gz format), choose Linux-generic and Linux-generic (glibc 2.5) (x86, 64-bit) Compressed TAR Archive, click Downloa The D button will go to the final download page.

    

5, if not login, registration, direct point below the No thanks, just start my download can start to download.

    

Second, upload the installation package to the server

1, using Ftpcute, WINSCP and other tools, you can upload the installation package to the server

2, the path is/usr/local.

Third, install MySQL

1. Access the server using the Linux Remote Connection tool such as Xshell.

2, enter/usr/local directory, instruction is cd/usr/local.

3, unpack the installation package, the instruction is TAR-XVF mysql-5.7.10-linux-glibc2.5-x86_64.tar.gz.

4, rename the extracted folder, instructions are MV mysql-5.7.10-linux-glibc2.5-x86_64 MySQL.

5, enter the MySQL directory, the instruction is cd/usr/local/mysql.

6, installation needs to open some permissions, first build a group, instructions are Groupadd MySQL, and then build a user, instructions are useradd-r-g MySQL MySQL.

7, modify the MySQL directory owner, the instruction is Chown-r mysql:mysql.

8, installation, instruction is bin/mysqld--initialize--user=mysql--basedir=/usr/local/mysql/--datadir=/usr/local/mysql/data/.

9. After successful installation, it will show [Note] A temporary password is generated for [email protected]: WT (otse:k3og,localhost: The following is the password to enter MySQL, Is randomly generated and must be remembered.

10, set boot, command is CP Support-files/mysql.server/etc/init.d/mysql.

IV. Configuring environment variables

1, open the environment variable file, the instruction is vi/etc/profile.

2. Press I or a to enter edit mode after opening.

3, in the last side to join

Export Mysql_home=/usr/local/mysql

Export path= $PATH: $MYSQL _home/bin

4. Then press ESC, then press: Wq, save and exit (that is, you need to press the SHIFT key at the same time to come out).

5, make the configuration effective, the instruction is source/etc/profile.

V. Start MySQL

1. The command to start MySQL is service MySQL start.

2. The command to stop MySQL is service MySQL stop.

3, if start failure, the error is the server quit without updating PID file (/var/lib/mysql/iz94bj5iyv4z.pid), One of the solutions is to delete the wrong configuration file my.cnf, renaming can also achieve this effect, the two instructions are CD/ETC,MV my.cnf my.cnf.backup. If you continue to fail, there are many reasons, you need to follow the actual situation of the server to solve, you can go to Baidu to find relevant information.

Six, reset the password and enter MySQL

1, first must reset the password, the instruction is/usr/local/mysql/bin/mysqladmin-u root-p password ' new password '.

2, and then enter the original password, the original password is installed randomly generated, you can return to find out carefully.

3, enter MySQL, instruction is mysql-u root-p.

4, enter the new password.

VII. Open MySQL remote access (each of the following directives is followed by a semicolon)

1, first follow the above steps into MySQL.

2, select the MySQL system database, instructions are use MySQL;.

3. To change the root user's localhost access to any access, the instruction is update user set host = '% ' where user = ' root ';

4. Enable all permissions, instruction is grant all privileges on * * to [email protected] '% ' identified by ' root ';.

5, need to manually refresh the permissions, instructions are flush privileges;

6, finally can use Navicat and other visual tools to access the database remotely.

Linux installation 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.