6. Install MySQL
# Configure environment variables and update immediately
Vi/etc/profile
Export Mysql_home= "/usr/local/mysql"
Export path= "$PATH: $MYSQL _home/bin"
Source/etc/profile
Wget http://120.52.72.24/cdn.mysql.com/c3pr90ntc0td//Downloads/MySQL-5.7/mysql-5.7.16-linux-glibc2.5-x86_64. Tar.gz-o/usr/local/src #glibc是编译过后的版本, no make install required
Cd/usr/local/src
TAR-ZXVF mysql-5.7.16-linux-glibc2.5-x86_64.tar.gz
mv/usr/local/src/mysql-5.7.16-linux-glibc2.5-x86_64 $MYSQL _home
Chown-r mysql:mysql $MYSQL _home #更改 $MYSQL _home permission is Mysql:mysql
Groupadd MySQL #添加用户组mysql
Useradd-r-G MySQL mysql-d $MYSQL _home #添加用户mysql, specifying that its user group is mysql,home path is $mysql_home
passwd MySQL #设置mysql用户的登陆密码
Yum Install-y Perl-module-install.noarch
$MYSQL _home/bin/mysqld--initialize--explicit_defaults_for_timestamp--user=mysql--basedir= $MYSQL _home--datadir= $MYSQL _home/data #第一次启动
2016-12-08t05:12:08.916945z 0 [Warning] innodb:new log files created, lsn=45790
2016-12-08t05:12:08.993901z 0 [Warning] innodb:creating FOREIGN KEY constraint system tables.
2016-12-08t05:12:09.048289z 0 [Warning] No existing UUID have been found, so we assume that's the first time that thi s server has been started. Generating a new UUID:DE6B7880-BD04-11E6-8EFB-080027798CA2.
2016-12-08t05:12:09.048994z 0 [Warning] Gtid table is not a ready-to-be used. Table ' mysql.gtid_executed ' cannot be opened.
2016-12-08t05:12:09.049893z 1 [Note] A temporary password is generated for [email protected]: 0w=a_kv.gt_k
CP $MYSQL _HOME/SUPPORT-FILES/ETC/MY.CNF #mysql服务启动配置文件
CP $MYSQL _home/support-files/mysql.server/etc/init.d/mysql #将mysql加入到可控制启动的服务的文件夹内 and name MYSQL, the service-controllable The service MySQL start control is now available to start MySQL
Chkconfig--add MySQL
Chkconfig MySQL on
Service MySQL Start
Mysql-u root-p
Enter Password: 0w=a_kv.gt_k
ALTER USER ' root ' @ ' localhost ' identified by ' 123456 '; #第一次改密码为 ' 123456 '
mysqladmin-uroot-p123456 password ' 123 ' #第二次及以后改密码
This article is from the "12382059" blog, please be sure to keep this source http://12392059.blog.51cto.com/12382059/1880864
CentOS7 installing MySQL