MySQL installation under Linux

Source: Internet
Author: User

1. installation package Download:

Official website Https://dev.mysql.com/downloads/mysql/5.6.html#downloads, I downloaded this version mysql-5.6.39-linux-glibc2.12-x86_64.tar.gz

Upload to Linux under/usr/software after download is complete

2. Unpack the installation package

Unzip in the/usr/software directory

Tar zxvf mysql-5.6.39-linux-glibc2.12-x86_64.tar.gz

Rename:

Mkdir-p/application/

MV Mysql-5.6.39-linux-glibc2.12-x86_64.tar.gz/application/mysql

3. Create user

Useradd-s/sbin/nologin-m MySQL

4. Create a soft connection

A soft connection is equivalent to a file alias, which is equivalent to a shortcut in window: Ln-s/application/mysql-5.6.34//application/mysql

5. Let MySQL user manage MySQL soft connection

Chown-r mysql.mysql/application/mysql/

6. Copy script to linux boot file directory

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

chmod +x/etc/init.d/mysqld

7. Modify the path in the startup script and MySQL command

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

8. Copy the default configuration file

Cp/application/mysql/support-files/my-default.cnf/etc/my.cnf

/etc/init.d/mysqld start service, there will be a malfunction

Plus initialization command:

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

Start again successfully

9.PATH Path
Echo ' Export path=/application/mysql/bin: $PATH ' >>/etc/profile
Source/etc/profile
which MySQL

10 adding power-on self-boot
Chkconfig--add mysqld
Chkconfig mysqld on

11. mysql Prompt error: Access denied for user ' root ' @ ' localhost

Workaround:

First Step: Stop service

/etc/init.d/mysql stop

Step Two: Skip password verification
To execute the command line:
#/usr/bin/mysqld_safe--skip-grant-tables

Then exit the login again to execute

/application/mysql/bin/mysqladmin-u root-p password ' 123456 ', will be prompted to enter the password, enter the password: 123456

Then log back in to the database hint

Can ' t connect to local MySQL server through socket '/tmp/mysql.sock ' (2)

At this point you change the/etc/my.cnf file and add the Socket=/tmp/mysql.sock

Modify the user to save, login again successfully entered

MySQL installation 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.