Successful operation of Kylin operating system installation mysql5.7.21

Source: Internet
Author: User
Tags chmod mkdir

Download the installation package on the website.
1. Check if the MySQL package is installed:
Rpm-qa | grep MySQL
Mysql-libs-5.1.73-8.el6_8.ns6.01.x86_64
Mysql-5.1.73-8.el6_8.ns6.01.x86_64
Mysql-devel-5.1.73-8.el6_8.ns6.01.x86_64
2. Uninstall:
RPM-E--nodeps mysql-libs-5.1.73-8.el6_8.ns6.01.x86_64
RPM-E--nodeps mysql-5.1.73-8.el6_8.ns6.01.x86_64
RPM-E--nodeps mysql-devel-5.1.73-8.el6_8.ns6.01.x86_64
3. Find MySQL installation path to delete each
Find/name MySQL
After that, the installation begins.
Mkdir/home/mysql
Mkdir/home/mysql/data
Groupadd MySQL
Useradd-g mysql-d/home/mysql MySQL
Unpacking the installation package
TAR-XZVF mysql-5.7.21-linux-glibc2.12-x86_64.tar.gz
CD mysql-5.7.21-linux-glibc2.12-x86_64
Move the directory to the Home/mysql directory and rename it
MV */home/mysql
Cd/home/mysql
Ls
Install, print the last behavior in the screen after the initial password is copied down for later use.
./bin/mysqld--user=mysql--basedir=/home/mysql--datadir=/home/mysql/data--initialize

Modify the Data directory permissions in the MySQL directory
Chown-r Mysql:mysql/home/mysql/data
Chmod-r 755/home/mysql/data
CD support-files/
Ls
Vim Mysql.server
Basedir=/home/mysql
Datadir=/home/mysql/data

: Wq
./support-files/mysql.server Start

If/etc/does not have my.cnf Xu Xian create a
Touch/etc/my.cnf
Vim/etc/my.cnf
[Client]
Port = 3306
#socket =/usr/local/mysql/data/mysql.sock
Default-character-set=utf8
Cd..
[Mysqld]

* * #sqlmode =noenginesubstitution,stricttranstables

General configuration options

**basedir =/home/mysql
DataDir =/home/mysql/data
Port = 3306
#socket =/usr/local/mysql/data/mysql.sock
Charactersetserver=utf8
initconnect= ' SET NAMES UTF8 ' * *
: Wq
(configuration files may be copied elsewhere) *

Put the startup script in the boot initialization directory
Cp/home/mysql/support-files/mysql.server/etc/init.d/mysqld

Creating a soft connection
Ln-s/home/mysql/bin/mysql/usr/bin/mysql

chmod 755/etc/init.d/mysql
chmod 755/etc/init.d/mysqld

Chkconfig--add mysqld to register MySQL as an open startup item
Chkconfig--list mysqld See if Add success
Chkconfig mysqld on

CD bin
./mysql-u Root-p
System-generated initial password
Set Password=password (' New password ');

Use MySQL;

Update user set host= '% ' where user= ' root ';

GRANT all privileges on . to [email protected] '% ' identified by ' Set password ' with GRANT OPTION;

FLUSH privileges;

Exit
Service mysqld Restart

Successful operation of Kylin operating system installation mysql5.7.21

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.