MySQL Installation tutorial

Source: Internet
Author: User

MySQL Installation tutorial


Preparing the MySQL installation package in advance (: http://mirrors.sohu.com/mysql/MySQL-5.6/)

The small part here is: mysql-5.6.34-linux-glibc2.5-x86_64.tar.gz

If necessary, contact the small part is responsible for sending you the package.


First step: Create a Directory

Mkdir-p/home/lsy/tools


Step two: Upload the downloaded installation package into the/home/lsy/tools directory.

Cd/home/lsy/tools

RZ mysql-5.6.34-linux-glibc2.5-x86_64.tar.gz


Step three: Unzip the MySQL binary package

Tar XF mysql-5.6.34-linux-glibc2.5-x86_64.tar.gz


Fourth step: Add the Admin user when the MySQL program runs

Useradd-s/sbin/nologin-m MySQL


Fifth step: Move the MySQL unpacked package to the program directory and rename it

Mkdir-p/application/

mv/home/lsy/tools/mysql-5.6.34-*-x86_64/application/mysql-5.6.34


Sixth step: Create a soft link for the MySQL service program

Ln-s/application/mysql-5.6.34//application/mysql


Seventh step: Let MySQL users manage/application/mysql/

Chown-r mysql.mysql/application/mysql/


Eighth step: Initializing the database

#1. Confirm where the software is installed

#2. Confirm where the data is stored

#3. Confirm the user who MySQL is using?

/application/mysql/scripts/mysql_install_db--basedir=/application/mysql--datadir=/application/mysql/data--user =mysql


(MySQL startup script is placed by default on Support-files/mysql.server)


Nineth Step: Copy the Startup script authorization

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

chmod +x/etc/init.d/mysqld


Tenth step: Modify the path in the startup script and the MySQL command

Sed-i ' S#/usr/local/mysql#/application/mysql#g '/application/mysql/bin/mysqld_safe/etc/init.d/mysqld


11th Step: Copy the default configuration file

\cp/application/mysql/support-files/my-default.cnf/etc/my.cnf


12th step: Start MySQL

/etc/init.d/mysqld start


13th step: Set the MySQL password

/application/mysql/bin/mysqladmin-u root password ' 123456 '


14th Step: Login Database Command Simplification method

Echo ' Export path=/application/mysql/bin: $PATH ' >>/etc/profile

Write variable and restart

Source/etc/profile

See if you have changed

[[email protected]]# which MySQL

/application/mysql/bin/mysql



15th Step: Set up the MySQL service boot from boot

Join power-on self-boot

Chkconfig--add mysqld

Chkconfig mysqld on



16th Step: Two ways to get into MySQL

[Email protected]]# mysql-u root-p123456


[Email protected]]# mysql-uroot-p

Enter password:123456



17th step: How to exit MySQL

Command line enter quit directly

Or you can use CTRL +d on the command line to not recommend Ctrl +C


This article is from the "Li Songyang" blog, make sure to keep this source http://lsy666.blog.51cto.com/11729318/1967799

MySQL Installation tutorial

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.