mysql 57 version is installed

1, download the tar package, where the use wget to download from the official website

wget https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.22-linux-glibc2.12-x86_64.tar.gz

 

2, installed to the mysql / usr / local / mysql
# decompression

tar -xvf mysql-5.7.22-linux-glibc2.12-x86_64.tar.gz

# Mobile

mv mysql-5.7.22-linux-glibc2.12-x86_64 /usr/local/

# Heavy naming

mv /usr/local/mysql-5.7.22-linux-glibc2.12-x86_64 /usr/local/mysql

 

3, the new data directory

mkdir /usr/local/mysql/data

 

4, the new user mysql, mysql user group
# mysql user group

groupadd mysql

# Mysql user

useradd mysql -g mysql

 

5, / usr / local / mysql belongs to the owner and group changed mysql

chown -R mysql.mysql /usr/local/mysql

 

6, configuration

/usr/local/mysql/bin/mysql_install_db --user=mysql --basedir=/usr/local/mysql/ --datadir=/usr/local/mysql/data

 

Performing error occurred:
 / usr / local / MySQL / bin / MySQL --basedir mysqld --user = = / usr / local / MySQL / --datadir = / usr / local / MySQL / Data - the initialize 
error is as follows:
 / usr / local / MySQL / bin / mysqld: error the while loading the Libraries Shared: libnuma.so.1 : CAN not Open Shared Object File: No File or Directory SUCH 
execute: 
yum - the y-install numactl
 # after the completion of the installation to continue

 

/usr/local/mysql/bin/mysqld --user=mysql --basedir=/usr/local/mysql/ --datadir=/usr/local/mysql/data --initialize

 

 

[mysqld]
datadir=/usr/local/mysql/data
basedir=/usr/local/mysql
socket=/tmp/mysql.sock
user=mysql
port=3306
character-set-server=utf8
# 取消密码验证
skip-grant-tables
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
# skip-grant-tables
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

 

7, open the service
# mysql join the service

cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysql

 

# Boot from Kai

chkconfig mysql on

 

# 开启

service mysql start

 

#查看初始密码
命令:cat /root/.mysql_secret

 

#登录

命令:bin/mysql -uroot -p

 

或者起别名:
alias mysql='/usr/local/mysql/bin/mysql'
vim ~/.bashrc
alias mysql='/usr/local/mysql/bin/mysql'
source ~/.bashrc
登录:mysql -u root -p

 

8、允许远程连接

mysql -u root -p
>>use mysql;
>>update user set host='%' where user = 'root';
>>flush privileges;
>>eixt;

  

Guess you like

Origin www.cnblogs.com/t-ym/p/11826244.html