vm+centos7(最小安装)+mysql5.7.10-glibc_64 安装 weir 2016-01-29 17:09:59.0 centos,mysql 2530 首先安装的最小版本的centos7 需要网络配置 vi /etc/sysconfig/network-scripts//ifcfg-eno16777736 我在网上找的有的人这个不是这样写的ifcfg-eno16777736 反正我这里是这样的。 关键配置: TYPE=Ethernet BOOTPROTO=static ONBOOT=yes IPADDR=192.168.117.128 NETMASK=255.255.255.0 GATEWAY=192.168.117.2 DNS1=192.168.117.2 重启网络 systemctl restart network 有了网络剩下的就好办了,没有什么直接安装就行了 这里不再啰嗦。 下载mysql-5.7.10-linux-glibc2.5-x86_64.tar 我是使用winscp 上传的,还有secureCRT 反正这两工具 基本搞定linux的操作。 然后解压 换个名字[root@weir home]# mv mysql-5.7.10-linux-glibc2.5-x86_64 mysql 然后添加 用户组和用户 [root@weir home]# groupadd mysql [root@weir home]# useradd -r -g mysql -s /bin/false mysql [root@weir home]# cd mysql [root@weir mysql]# ll 然后创建data目录存在数据 [root@weir mysql]# mkdir data [root@weir mysql]# ll 设置权限 [root@weir mysql]# chmod 770 data [root@weir mysql]# show showconsolefont showkey [root@weir mysql]# chown -R mysql . [root@weir mysql]# chgrp -R mysql . 然后就可以初始化了 [root@weir mysql]# bin/mysqld --initialize --user=mysql --basedir=/home/mysql --datadir=/home/mysql/data 2016-01-29T08:32:48.052892Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details). 2016-01-29T08:32:48.360490Z 0 [Warning] InnoDB: New log files created, LSN=45790 2016-01-29T08:32:48.450017Z 0 [Warning] InnoDB: Creating foreign key constraint system tables. 2016-01-29T08:32:48.520409Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: e0cb9f6b-c662-11e5-9fa5-000c2949115e. 2016-01-29T08:32:48.522223Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened. 2016-01-29T08:32:48.523840Z 1 [Note] A temporary password is generated for root@localhost: k4a*xr1r;qC= [root@weir mysql]# cp support-files/m 接下来把配置文件拷贝到指定位置 [root@weir mysql]# cp support-files/my-default.cnf /etc/my.cnf cp:是否覆盖"/etc/my.cnf"? y [root@weir mysql]# cp support-files/mysql.server /etc/init init.d/ inittab [root@weir mysql]# cp support-files/mysql.server /etc/init.d/mysql 修改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 = /home/mysql datadir = /home/mysql/data # port = ..... # server_id = ..... socket = /tmp/mysql.sock # 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 在设置 开机启动 [root@weir mysql]# chkconfig --add mysql [root@weir mysql]# chkconfig --level 2345 mysql on 完了以后重启reboot 重启之后 [root@weir mysql]# mysql -u root -p Enter password: 密码是 初始化的那个。 修改密码 mysql> set password =password('336393'); 剩下的工作 自己配置吧。