centos 7下安装mysql

时间:2022-03-22 01:10:49
可参考:
http://blog.csdn.net/xyang81/article/details/51759200

1.去mysql官方网站查询最新的版本:

centos 7下安装mysql
2.运行指令:
wget http://dev.mysql.com/get/mysql57-community-release-el7-9.noarch.rpm
yum localinstall mysql57-community-release-el7-9.noarch.rpm
yum repolist enabled
3.下面要做到的就是
3.1 查询mysql 安装位置;
3.2 查询初始密码;
3.3 修改初始密码;
3.4 登录,看是否成功;
centos 7下安装mysql
centos 7下安装mysql
centos 7下安装mysql
centos 7下安装mysql
centos 7下安装mysql
centos 7下安装mysql
centos 7下安装mysql

grep 'temporary password' /var/log/mysqld.log;

set password for 'root'@'localhost'=password('123456');

centos 7下安装mysql

Database changed
mysql> grant all privileges on *.* to 'root'@'%' identified by '123456'
    -> ;
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

开机启动

shell> systemctl enable mysqld

shell> systemctl daemon-reload

UTF-8问题;

1.

vim /etc/my.cnf

centos 7下安装mysql

centos 7下安装mysql

配置文件:

sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
character-set-server=utf8
innodb_flush_log_at_trx_commit=0
interactive_timeout=31536000
wait_timeout=31536000
default-time_zone='+8:00'