mysql linux installation (1) - tar.gz method

1. Download

wget http://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.33-linux-glibc2.5-x86_64.tar.gz

 

2. Decompression

tar -zxvf mysql-5.6.33-linux-glibc2.5-x86_64.tar.gz

Then copy to /usr/local/mysql

cp -r mysql-5.6.33-linux-glibc2.5-x86_64 /usr/local/mysql

 

3. Add user groups and users

#添加用户组
groupadd mysql
#添加用户mysql 到用户组mysql

 

useradd  -g mysql mysql

 

4. Installation

cd /usr/local/mysql/data

create mysql folder

mkdir  mysql

Change the owner of this directory

chown -R mysql:mysql ./

Execute the installation command:

./scripts/mysql_install_db --user=mysql --datadir=/usr/local/mysql/data/mysql

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

grant permission

chmod 755 /etc/init.d/mysqld

cp support-files/my-default.cnf /etc/my.cnf

#Modify the startup script

vi /etc/init.d/mysqld

#Modification items:

basedir=/usr/local/mysql/

datadir=/usr/local/mysql/data/mysql

 

5. Add environment variables and edit /etc/profile, so that you can use mysql commands anywhere

export PATH=$PATH:/usr/local/mysql//bin

source /etc/profile

 

6. Start the service

#启动mysql
service mysqld start
#关闭mysql
service mysqld stop
#查看运行状态
service mysqld status
#测试连接
. /mysql/bin/mysql  -uroot

 

 Linux installation mysql gz method reference:

http://www.cnblogs.com/bookwed/p/5896619.html

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326218795&siteId=291194637