欢迎您来到腾讯云!积分商城

腾讯云腾讯云论坛

 找回密码
 立即注册
忘了密码?

扫一扫,访问微社区

快捷导航
搜索
查看: 838|回复: 0

[经验分享] linux安装mysql 5.7

[复制链接]

6

主题

0

好友

600

积分

程序猿[LV2]

Rank: 2Rank: 2

云币
2040
威望
600
发表于 2018-1-15 06:38:05 |显示全部楼层 |未分类
[root@VM_243_140_centos ~]# wget https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-5.7.19-linux-glibc2.12-x86_64.tar.gz
--2018-01-15 06:01:26--  https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-5.7.19-linux-glibc2.12-x86_64.tar.gz
Resolving cdn.mysql.com... 23.219.134.205
Connecting to cdn.mysql.com|23.219.134.205|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 640650826 (611M) [application/x-tar-gz]
Saving to: “mysql-5.7.19-linux-glibc2.12-x86_64.tar.gz”

100%[=================================================================================================================================================================>] 640,650,826 2.27M/s   in 4m 42s  

2018-01-15 06:06:09 (2.17 MB/s) - “mysql-5.7.19-linux-glibc2.12-x86_64.tar.gz” saved [640650826/640650826]

[root@VM_243_140_centos ~]# tar -xf mysql-5.7.19-linux-glibc2.12-x86_64.tar.gz -C /usr/local/

[root@VM_243_140_centos ~]# cd /usr/local/mysql-5.7.19-linux-glibc2.12-x86_64/
[root@VM_243_140_centos mysql-5.7.19-linux-glibc2.12-x86_64]# ls
bin  COPYING  docs  include  lib  man  README  share  support-files
[root@VM_243_140_centos mysql-5.7.19-linux-glibc2.12-x86_64]# cd ..
[root@VM_243_140_centos local]# mv  mysql-5.7.19-linux-glibc2.12-x86_64 mysql
[root@VM_243_140_centos local]# rpm -qa | grep mysql
mysql-libs-5.1.73-8.el6_8.x86_64
[root@VM_243_140_centos local]# rpm -e --nodeps mysql-libs-5.1.73-8.el6_8.x86_64
[root@VM_243_140_centos local]# rpm -qa | grep mysql
[root@VM_243_140_centos local]#
[root@VM_243_140_centos local]# cat /etc/group | grep mysql
[root@VM_243_140_centos local]# cat /etc/passwd |grep mysql
[root@VM_243_140_centos local]# groupadd mysql
[root@VM_243_140_centos local]# useradd -r -g mysql mysql
[root@VM_243_140_centos local]# cd /usr/local/mysql/
[root@VM_243_140_centos mysql]# ls
bin  COPYING  docs  include  lib  man  README  share  support-files
[root@VM_243_140_centos mysql]# mkdir data
[root@VM_243_140_centos mysql]# cd ..
[root@VM_243_140_centos local]# chown -R mysql mysql/
[root@VM_243_140_centos local]# chgrp -R mysql mysql/
[root@VM_243_140_centos local]# ll mysql/
total 56
drwxr-xr-x  2 mysql mysql  4096 Jan 15 06:13 bin
-rw-r--r--  1 mysql mysql 17987 Jun 22  2017 COPYING
drwxr-xr-x  2 mysql mysql  4096 Jan 15 06:19 data
drwxr-xr-x  2 mysql mysql  4096 Jan 15 06:13 docs
drwxr-xr-x  3 mysql mysql  4096 Jan 15 06:13 include
drwxr-xr-x  5 mysql mysql  4096 Jan 15 06:13 lib
drwxr-xr-x  4 mysql mysql  4096 Jan 15 06:10 man
-rw-r--r--  1 mysql mysql  2478 Jun 22  2017 README
drwxr-xr-x 28 mysql mysql  4096 Jan 15 06:13 share
drwxr-xr-x  2 mysql mysql  4096 Jan 15 06:13 support-files
[root@VM_243_140_centos local]# ./mysql/bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql/ --datadir=/usr/local/mysql/data/ --lc_messages_dir=/usr/local/mysql/share --lc_messages=en_US
2018-01-14T22:22:20.141434Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2018-01-14T22:22:20.521466Z 0 [Warning] InnoDB: New log files created, LSN=45790
2018-01-14T22:22:20.551477Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2018-01-14T22:22:20.605406Z 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: 630a1657-f979-11e7-ad38-525400c34db7.
2018-01-14T22:22:20.606269Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2018-01-14T22:22:20.607467Z 1 [Note] A temporary password is generated for root@localhost: sLLzTvN(A6/l
[root@VM_243_140_centos local]#
[root@VM_243_140_centos local]# echo '#[mysql] ' >> /etc/my.cnf
[root@VM_243_140_centos local]# echo '#basedir=/usr/local/mysql/' >> /etc/my.cnf
[root@VM_243_140_centos local]# echo '#datadir=/usr/local/mysql/data/' >> /etc/my.cnf
[root@VM_243_140_centos local]# cat /etc/my.cnf
#[mysql]
#basedir=/usr/local/mysql/
#datadir=/usr/local/mysql/data/
[root@VM_243_140_centos local]#


[root@VM_243_140_centos local]# cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysql
[root@VM_243_140_centos local]# chmod +x /etc/init.d/mysql
[root@VM_243_140_centos local]# chkconfig --add mysql  
[root@VM_243_140_centos local]# chkconfig --list mysql
mysql                  0: off        1: off        2: on        3: on        4: on        5: on        6: off
[root@VM_243_140_centos local]# service mysql start
Starting MySQL. SUCCESS!
[root@VM_243_140_centos local]# ln -s /usr/local/mysql/bin/* /usr/local/bin/
[root@VM_243_140_centos local]# mysql -uroot -p'sLLzTvN(A6/l'
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.7.19

Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> set password=password("yipingbuman");
Query OK, 0 rows affected, 1 warning (0.00 sec)

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

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

mysql> ^DBye
[root@VM_243_140_centos local]#







您需要登录后才可以回帖 登录 | 立即注册
您需要登录后才可以发帖 QQ登录

联系我们|腾讯云平台|积分商城|腾讯云官方论坛    

GMT+8, 2018-10-18 23:02 , Processed in 1.164855 second(s), 29 queries .

Powered by Discuz! X2.5

© 2001-2012 Comsenz Inc.

回顶部