Installing the MySQL Database

Source: Internet
Author: User

1. Install MySQL Database

① download MySQL Packet

wget http://mirrors.sohu.com/mysql/MySQL-5.6/mysql-5.6.35-linux-glibc2.5-x86_64.tar.gz

② Extracting packages under/USR/LOCAL/SRC

Tar zxvf mysql-5.6.35-linux-glibc2.5-x86_64.tar.gz

③ Rename the unpacked package to MySQL

MV Mysql-5.6.35-linux-glibc2.5-x86_64/usr/local/mysql

④ Create a user named MySQL and the/data/folder to hold the data for the MySQL database

Useradd MySQL mkdir/data/

⑤ running the script installation database

[Email protected]_01 mysql]#/scripts/mysql_install_db--user=mysql--datadir=/data/mysqlfatal error:please Install The following Perl modules before executing./scripts/mysql_install_db:data::D umper

There is an error here that you need to install Dumper first and fix the problem after installing Perl-data-dumper

[Email protected]_01 mysql]# Yum install-y perl-data-dumper

⑥ Copy the MySQL template configuration file to/etc/my.cnf. and modify the socket and DataDir values to the following:

Datadir=/data/mysqlsocket=/tmp/mysql.sock

⑦ Configuring startup files

Copy mysql.server files to/etc/init.d/mysqld, configure Basedir and DataDir

[Email protected]_01 mysql]# CP Support-files/mysql.server/etc/init.d/mysqldbasedir=/usr/local/mysqldatadir=/data /mysql

Adding mysqld to the startup service

[[email protected]_01 mysql]# chkconfig --add mysqld[[email protected]_01  Mysql]# chkconfig --list Note: This output shows only the  SysV  service and does not contain native  systemd  services. sysv  configuration data may be overwritten by native  systemd  configuration.        If you want to list  systemd  services, please do   ' systemctl list-unit-files '.        to view services that are enabled for a specific  target , perform the        ' Systemctl list-dependencies [target] '. Mysqld          0: Guan     1: Guan      2: Open     3: Open     4: Open     5: Open      6: Guan netconsole      0: Guan     1: Guan      2: Guan     3: Guan     4: Guan     5: Guan      6: Guan network         0: Off     1: Off     2: Kai     3: Kai      4: Open     5: Open     6: Off service based on  xinetd :         chargen-dgram:   Customs          chargen-stream:  off         daytime-dgram:   off          daytime-stream:  Customs          discard-dgram:   off         discard-stream:  off          echo-dgram:      Customs          echo-stream:     Customs          tcpmux-server:   Guan         time-dgram:       Customs         time-stream:     off 

⑧ start Service

[[Email protected]_01 mysql]# service mysqld startstarting mysql.logging to   '/data/mysql/test_01.err ' ...  success! [[email protected]_01 mysql]# netstat -lntpactive internet connections  ( Only servers) proto recv-q send-q local address            foreign address         state        PID/Program nametcp         0      0 0.0.0.0:22               0.0.0.0:*                LISTEN      1411/sshdtcp         0      0 127.0.0.1:25            0.0.0.0:*                listen      2075/mastertcp         0      0  192.168.231.128:873     0.0.0.0:*                LISTEN      5995/rsynctcp6        0      0 :::3306                  :::*                      LISTEN       9562/mysqldtcp6       0       0 :::22                    :::*                       LISTEN      1411/sshdtcp6       0       0 ::1:25                   :::*                      listen      2075/ Master


Installing the MySQL Database

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.