Install mysql in linux and mysql in linux

Source: Internet
Author: User

Install mysql in linux and mysql in linux

1. Download mysql. Here I advocate binary installation.

Use winSCP to transmit the downloaded mysql to the linux Server

2. decompress the downloaded mysql package

#tar -zxvf  /{MySQL5.6_path}/mysql-{version}.tar.gz
Here there are four parameters, representing

X: extract the file from the tar package; z: indicates that the tar package is compressed;

V: Show Details. f: xxx.tar.gz: specifies that the file to be processed is xx.tar.gz.

3. Modify the name

#mv mysql-5.6.20-linux-glibc2.5-i686 mysql

4. Copy the extracted mysql file to/usr/local.

#cp /mysql /usr/local
5. Modify the creator and creation group of folders and files at various levels of mysql as mysql (note that the statement is followed by .)

 
Cd mysqlchown-R mysql. <pre name = "code" class = "plain"> // change the owner of the current directory to a mysql user and add the-R parameter. This parameter indicates looping through subnodes. All sub-nodes work
Chgrp-R mysql.
// Change all groups in the current directory to the mysql Group

 

6. At this point, mysql has been installed, but Initialization is required. initialize mysql tables, test tables, and infomation tables.

#scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data

#cp support-files/mysql.server /etc/init.d/mysqld

7. modify the configuration file

# Cp my. cnf/etc/my. cnf/usr/local/mysql [root @ 10-4-5-9 mysql] # vi/etc/my. add basedir =/usr/local/mysqldatadir =/usr/local/mysql/dataport = 3306server_id = 1 to cnf [mysqld]
8. Start the mySQL Service

Bin/mysqld_safe -- user = mysql & // "&" indicates running in the background

Steps:
Step 1: Check whether mysql is successfully installed.
One way is to check whether port 3306 is enabled.
Command: netstat-ntl can list all listening ports

Method 2: Use the mysql command to connect to the server once.
Command:

/usr/bin# mysql -uroot -piamnts


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.