centos 6.7 mysql rpm_CentOS6.7中安装mysql5.7.23(rpm方式)

标签:

1、 查以前是否装过Mysql(以前装过,注意将之前的文件删除,见文件最后列表)

rpm -qa|grep -i mysql

2、 发现有的话就都卸载

rpm -e --nodeps mysql-libs-5.1.73-5.el6_6.x86_64

3、 删除老版本 mysql 的开发头文件和库

rm -rf /usr/lib/mysql

rm -rf /usr/include/mysql

rm -rf /etc/my.cnf

rm -rf /var/lib/mysql

4.下载:mysql-5.7.23-1.el6.x86_64.rpm-bundle

eb934ba7cd32971c13ced3cd089a826e.png

5.上传到linux,文件夹自定义,解压:

dd37703b74e245c1f2182b20dcb8c29a.png

6.安装:

rpm -ivh mysql-community-common-5.7.23-1.el6.x86_64.rpm

rpm -ivh mysql-community-libs-5.7.23-1.el6.x86_64.rpm

rpm -ivh mysql-community-libs-compat-5.7.23-1.el6.x86_64.rpm

rpm -ivh mysql-community-client-5.7.23-1.el6.x86_64.rpm

rpm -ivh mysql-community-server-5.7.23-1.el6.x86_64.rpm

7.初始化启动:

mysql5.7.23是有区别的:可能会出现错错误:

[root@hadoop04 log]# service mysqld start

Initializing MySQL database:                               [FAILED]

[root@hadoop04 log]# mysqld --initialize

2018-09-28T17:05:43.190726Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).

2018-09-28T17:05:43.193357Z 0 [ERROR] --initialize specified but the data directory has files in it. Aborting.

2018-09-28T17:05:43.193388Z 0 [ERROR Aborting

这时需要将my.cnf进行修改:

vi /etc/my.cnf

添加如下信息:explicit_defaults_for_timestamp=true

8a6851032984cd71f4d3cbeabf3905c5.png

[root@hadoop04 etc]# service mysqld start

Starting mysqld:                                           [  OK  ]

8.启动成功,进行登陆:进入日志文件查看随机登陆密码:vim /var/log/mysqld.log

[root@hadoop04 etc]# service mysqld start

Starting mysqld:                                           [  OK  ]

[root@hadoop04 etc]# vim /var/log/mysqld.log

2018-09-28T17:04:57.173921Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is

deprecated. Please use --explicit_defaults_for_timestamp server option (see doc

umentation for more details).

2018-09-28T17:04:59.663198Z 0 [Warning] InnoDB: New log files created, LSN=45790

2018-09-28T17:04:59.849122Z 0 [Warning] InnoDB: Creating foreign key constraint

system tables.

2018-09-28T17:05:00.129041Z 0 [Warning] No existing UUID has been found, so we a

ssume that this is the first time that this server has been started. Generating

a new UUID: a231b50b-c340-11e8-9cdb-000c29d3d125.

2018-09-28T17:05:00.132428Z 0 [Warning] Gtid table is not ready to be used. Tabl

e 'mysql.gtid_executed' cannot be opened.

2018-09-28T17:05:00.134282Z 1 [Note] A temporary password is generated for root@

localhost: cj#%j.=19#vC

2018-09-28T17:05:02.345952Z 1 [ERROR] Failed to open the bootstrap file /var/lib

/mysql-files/install-validate-password-plugin.RdxfeP.sql

2018-09-28T17:05:02.345987Z 1 [ERROR] 1105  Bootstrap file error, return code (0

). Nearest query: 'LSE SET @sys.tmp.table_exists.SQL = CONCAT('SELECT COUNT(*) F

ROM `', in_db, '`.`', in_table, '`'); PREPARE stmt_select FROM @sys.tmp.table_ex

ists.SQL; IF (NOT v_error) THEN DEALLOCATE PREPARE stmt_select; SET out_exists =

'TEMPORARY'; END IF; ENd IF; END;

登陆进来后:无法进行查看操作,这是MySQL5.7.23的设置,需要我们先设置密码:

[root@hadoop04 etc]# mysql -uroot -pcj#%j.=19#vC

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 3

Server version: 5.7.23

Copyright (c) 2000, 2018, 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> show databases;

ERROR 1820 (HY000): You must reset your password using ALTER USER statshent befo

设置密码:

mysql> set password for 'root'@'localhost'=password('root');

Query OK, 0 rows affected, 1 warning (0.00 sec)

授予任何ip通过root用户访问权限:

mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'root' WITH GRANT OPTION;

Query OK, 0 rows affected, 1 warning (0.00 sec)

#刷新,使权限生效:

mysql> flush privileges;

Query OK, 0 rows affected (0.01 sec)

9.到此安装完成。

多次安装注意删除的文件(这些文件实在安装过程中生成的,再次安装需要删除,不然会出错):

日志文件:rm -rf /etc/log/mysql.log

数据库目录:rm -rf /var/lib/mysql/

命令配置:rm -rf /usr/share/mysql

启动脚本:rm -rf /etc/rc.d/init.d/

系统配置:rm -rf /etc/my.conf

标签:

来源: https://blog.csdn.net/qq_15508167/article/details/82887406

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值