MySQL under Linux

Source: Internet
Author: User

1. Download the generic binary package to the address below

wget http://mirrors.sohu.com/mysql/MySQL-5.5/mysql-5.5.53-linux2.6-x86_64.tar.gz

2, the specific installation documentation

Http://dev.mysql.com/doc/refman/5.5/en/binary-installation.html

Shell>groupadd mysql
Shell>useradd -r -g mysql -s /bin/false mysql
Shell>cd /usr/local
Shell>tar zxvf /path/to/mysql-VERSION-OS.tar.gz
Shell>ln -s full-path-to-mysql-VERSION-OS mysql
Shell>cd mysql
Shell>chown -R mysql .
Shell>chgrp -R mysql .
Shell>scripts/mysql_install_db --user=mysql
Shell>chown -R root .
Shell>chown -R mysql data
# Next command is optional
Shell>cp support-files/my-medium.cnf /etc/my.cnf
Shell>bin/mysqld_safe --user=mysql &
# Next command is optional
Shell>cp support-files/mysql.server /etc/init.d/mysql.server

3. Installation explanation

Create MySQL users and groups for system users and system groups

Groupadd-r-G 306 MySQL

Useradd-r-G 306-u 306 MySQL

Unzip the downloaded tar package to the specified directory, typically/usr/local/mysql

TAR-XF mysql-5.5.53-linux2.6-x86_64.tar.gz-c/usr/local

Create a soft connection under/usr/local, link to mysql-5.5.53-linux2.6-x86_64.tar.gz

LN-SV mysql-5.5.53-linux2.6-x86_64.tar.gz MySQL

Change the main group of files in MySQL directory to MySQL

Chown-r mysql:mysql/usr/local/mysql/*

Create a new logical volume for storing data

Create new partition FDISK/DEV/SDA partition type to Linux LVM

Create a physical volume Pvcreate/dev/sda5

Create a volume group Vgcreate myvg/dev/sda5

Create a logical Volume Lvcreate-n mydata-l 5G MYVG

Formatted MKE2FS-J/dev/myvg/mydata

Execute initialization script

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

Change MySQL directory owner to Root

Chown-r root/usr/local/mysql/*

Copy the configuration file from the Support-files directory to the/ETC/MY.CNF, modify the configuration file, and add the Datadir=/mydata/data

Cp/usr/local/mysql/support-files/my-large.cnf/etc/my.cnf

Copy the Mysql.server under the Support-files directory to the/ETC/INIT.D directory and set the service self-start

Cp/usr/local/mysql/support-files/mysql.server/etc/init.d/mysqld

Systemctl Enable Mysqld

Output man document, library file, header file

Vim/etc/man_db.conf Adding a man document directory

Vim/etc/ld.so.conf.d/mysql.conf adding a Lib directory

Ln-sv/usr/local/mysql/include/usr/include

MySQL under Linux

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.