CentOS 7.2 编译安装 MySQL 5.7.14(2)

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

4、拷贝配置文件,修改配置文件

1 cp support-files/my-default.cnf /etc/my.cnf 2 [root@lnmp ~]# cat /etc/my.cnf 3 # For advice on how to change settings please see 4 # http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html 5 # *** DO NOT EDIT THIS FILE. It's a template which will be copied to the 6 # *** default location during install, and will be replaced if you 7 # *** upgrade to a newer version of MySQL. 8 [mysqld] 9 # Remove leading # and set to the amount of RAM for the most important data 10 # cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%. 11 # innodb_buffer_pool_size = 128M 12 character_set_server=utf8 13 init_connect='SET NAMES utf8' 14 #skip-grant-tables 15 # Remove leading # to turn on a very important data integrity option: logging 16 # changes to the binary log between backups. 17 # log_bin 18 # These are commonly set, remove the # and set as required. 19 # basedir = ..... 20 #datadir = /usr/local/mysql/data 21 # port = ..... 22 # server_id = ..... 23 # socket = ..... 24 # Remove leading # to set options mainly useful for reporting servers. 25 # The server defaults are faster for transactions and fast SELECTs. 26 # Adjust sizes as needed, experiment to find the optimal values. 27 # join_buffer_size = 128M 28 # sort_buffer_size = 2M 29 # read_rnd_buffer_size = 2M 30 sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES 31 [client] 32 default-character-set=utf8

5、拷贝启动文件,并授权

1、cp support-files/mysql.server /etc/init.d/mysqld 2、chmod 755 /etc/init.d/mysqld

6 、启动数据库

  

/etc/init.d/mysqld start

三、更改初始化生成的数据库密码

注:由于5.7版本会初始化设置密码,需要自己修改,跟之前的数据库版本更改方式不一样。

完整的更改MySQL密码的方式如下:

vim /etc/my.cnf 加入skip-grant-tables,免密码登录数据库

CentOS 7.2 编译安装 MySQL 5.7.14

注:我这里注释掉是改完之后再演示的。

重启MySQL数据库

[root@lnmp ~]# /etc/init.d/mysqld restart Shutting down MySQL.. SUCCESS! Starting MySQL. SUCCESS!

登录数据,修改密码即可,注5.7的password字段改为authentication_string

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/d475eb88126dc7f99a79bf93fd171614.html