MySQL Learning note 01 Installing the MySQL Server Software

Source: Internet
Author: User

1.1. default Installation

As an example of MySQL Community server 5.7.19 , the installation steps are as follows:

(1) installation Libaio . The version must be greater than or equal to this version.

Libaio1_0.3.109-4_amd64.deb

Deb File Installation method:

sudo dpkg-i libaio1_0.3.109-4_amd64.deb

(2) installation LIBMECAB2 . The version must be greater than or equal to this version.

Libmecab2_0.996-1.1_amd64.deb

(3) download.

After downloading Mysql-server_5.7.19-1ubuntu14.04_amd64.deb-bundle.tar, unzip to get multiple installation packages.

(4) you need to install the following packages in turn:

Mysql-common_5.7.19-1ubuntu14.04_amd64.deb Mysql-community-client_5.7.19-1ubuntu14.04_amd64.deb Mysql-community-server_5.7.19-1ubuntu14.04_amd64.deb

(5) Verification.

The Mysql-uroot-p connection was performed successfully.

1.2. Change Directory

By default , the MySQL Data directory is under the /var/lib/mysql directory and is now modified to the /opt/mysql/data directory. Also modify the mysql log directory to the /opt/mysql/log directory.

(1) stop the MySQL service.

sudo service MySQL stop

(2) prepare mysql directory for various.

Copy the directory to /opt/mysql .

sudo cp-arp mysql/opt/mysql/.

sudo cp-arp mysql-*/opt/mysql/.

set up the/opt/mysql/log directory and modify the properties and the owner of the user as mysql.

If the directory structure is incorrect, the MySQL service will not start properly .

(3) Modify the AppArmor configuration file.

Modify the following file to replace the/var/lib/mysql and other directories in the new /opt/mysql related directory.

/etc/apparmor.d/usr.sbin.mysqld

If you do not modify this file, the MySQL service will not start properly .

Restart the AppArmor service.

sudo service apparmor restart

(4) To modify the mysqld configuration file:

Modify each directory in the/etc/mysql/mysql.conf.d/mysqld.cnf file:

[Mysqld]

Pid-file =/var/run/mysqld/mysqld.pid

Socket =/var/run/mysqld/mysqld.sock

DataDir =/opt/mysql/data

Log-error =/opt/mysql/log/error.log

# By default we only accept connections from localhost

Bind-address = 192.168.197.101

# Disabling Symbolic-links is recommended to prevent assorted security risks

Symbolic-links=0

(5) start the MySQL service.

sudo service MySQL start

(6) Verification.

Mysql-uroot-p

The connection was successful.

at this point, the MySQL service started successfully.

MySQL Learning note 01 Installing the MySQL Server Software

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.