Install mysql and linuxmysql in Linux

Source: Internet
Author: User

Install mysql and linuxmysql in Linux

Install mysql in Linux

-- @ Liang WP

Abstract: Install mysql in Linux.

 

1. Download mysql

1. Search for mysql in Baidu. One of the results is marked with MySQL Downloads. Click to go To the mysql official website.

    

2. After Entering the mysql official website, you can see MySQL Community Edition (GPL) below. Click the link below to go To the download list.

    

3. Find MySQL Community Server in the download list and click the following link to go to the product selection page.

    

4. Select the corresponding operating system and then select the appropriate region (.gz format). Select Linux-Generic and Linux-Generic (glibc 2.5) (x86, 64-bit) Compressed TAR Archive. Click the Download button to go to the final Download page.

    

5. If you do not log on or register, click No thanks and just start my download to start downloading.

    

 

Ii. Upload the installation package to the server

1. Use FTPCute, WinSCP, and other tools to upload the installation package to the server.

2. The path is/usr/local.

 

Iii. Install mysql

1. Use Linux remote connection tools such as Xshell to access the server.

2. Enter the/usr/local directory. The command is cd/usr/local.

3. Unzip the installation package and the command is tar-xvf mysql-5.7.10-linux-glibc2.5-x86_64.tar.gz.

4, rename the decompressed folder, command is mv mysql-5.7.10-linux-glibc2.5-x86_64 mysql.

5. Go to the mysql directory and run the command cd/usr/local/mysql.

6. Before installation, you need to set up some permissions. First, create a group. The command is groupadd mysql, and then create a user. The command is useradd-r-g mysql.

7. Modify the owner of the mysql directory. The command is chown-R mysql: mysql ./.

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

9. After the installation is successful, [Note] A temporary password is generated for root @ localhost: wT (otse: k3Og, localhost: the password for entering mysql is displayed, it is generated randomly and must be remembered.

10. Set the startup command to cp support-files/mysql. server/etc/init. d/mysql.

 

Iv. Configure Environment Variables

1. Open the environment variable file. The command is vi/etc/profile.

2. Press I or a to enter the editing mode.

3. Add at the end

Export MYSQL_HOME =/usr/local/mysql

Export PATH = $ PATH: $ MYSQL_HOME/bin

4. Press Esc, and then press: wq to save and exit (that: shift is required at the same time ).

5. Make the configuration take effect. The command 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 The startup fails, The error is The server quit without updating PID file (/var/lib/mysql/iZ94bj5iyv4Z. pid), one of the solutions is to put the wrong configuration file my. delete cnf and rename the command. The two commands are cd/etc, mv my. cnf my. cnf. backup. If the startup fails, there are many causes, which need to be solved based on the actual situation of the server. You can go to Baidu to find relevant information.

 

6. Reset the password and enter mysql

1. First, you must reset the password. The command is/usr/local/mysql/bin/mysqladmin-u root-p password 'new password '.

2. Enter the original password. The original password is randomly generated during installation. You can go back and look for it carefully.

3. Enter mysql. The command is mysql-u root-p.

4. enter a new password.

 

7. Open mysql Remote Access (all commands below are followed by semicolons)

1. First, follow the steps above to enter mysql.

2. Select the mysql System database. The command is use mysql ;.

3. Change the root user's localhost access to any access. The command is update user set host = '%' where user = 'root ';.

4. Enable all permissions. The command is grant all privileges on *. * to root @ '%' identified by 'root ';.

5. You need to manually refresh the permission. The command is flush privileges ;.

6. You can use visual tools such as navicat to remotely access the database.

 

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.