CentOS6.5でmysql-5.7.18-linux-glibc 2をインストールします.5-x86_64

5699 ワード

mysqlをインストールする前に、次のコマンドを実行します.
rpm -qa | grep mysql #  mysql    
yum -y remove mysql-libs-5.1.71-1.el6.x86_64 #  mysql-libs-5.1.71-1.el6.x86_64

まずmysql-5.7.18-linux-glibc 2をダウンロードします.5-x86_64.tar.gz、CentOS 6に伝える.5システム下の/usr/localディレクトリで、次のコマンドを実行します.
yum search libaio  # search for info
yum install libaio # install library
groupadd mysql
useradd mysql -g mysql
cd /usr/local
tar -zxvf /usr/local/mysql-5.7.18-linux-glibc2.5-x86_64.tar.gz
mv mysql-5.7.18-linux-glibc2.5-x86_64/ mysql
cd mysql/
mkdir data
cd ../
chown -R mysql:mysql mysql/
chmod -R 755 mysql/
cd mysql
./bin/mysqld --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --initialize 

パスワードを検索します.一般的にコマンドの最後に、
 2017-04-21T02:36:15.620346Z 1 [Note] A temporary password is generated for root@localhost: o*s#gqh)F4Ck  
./support-files/mysql.server start
ln -s /usr/local/mysql/support-files/mysql.server /etc/init.d/mysql
service mysql restart #    mysql
ln -s /usr/local/mysql/bin/mysql /usr/bin #     ,       mysql   /usr/bin    
mysql -uroot -po*s#gqh)F4Ck
alter user 'root'@'localhost' identified by '123456'; #  root    123456
use mysql;
update user set user.Host='%' where user.User='root';
flush privileges;
[root@localhost ~]# chkconfig mysql on #  mysql      

最後に、プロファイルを追加できます.
vi /usr/local/mysql/my.cnf #  my.cnf

構成内容は次のとおりです.
# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html
# *** DO NOT EDIT THIS FILE. It's a template which will be copied to the
# *** default location during install, and will be replaced if you
# *** upgrade to a newer version of MySQL.

[mysqld]

# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M

# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin

# These are commonly set, remove the # and set as required.
# basedir = .....
# datadir = .....
port = 3306
# server_id = .....
# socket = .....

# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M 

sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES