mysql5.7.13 安装
2016-06-17 00:00
441 查看
摘要: windows下载mysql压缩包,linux下下载mysql安装包,所有版本的路径
先查看自己的版本
2.6.32-431.23.3.el6.x86_64
到网站找el6.x86_64 的mysql 安装包
先查看自己的版本
# uname -r
2.6.32-431.23.3.el6.x86_64
到网站找el6.x86_64 的mysql 安装包
[root@iZ25av9xi4hZ opt]# wget http://mirrors.sohu.com/mysql/MySQL-5.7/mysql-5.7.13-1.el6.x86_64.rpm-bundle.tar[/code]
mysql 版本下载地址 http://mirrors.sohu.com/mysql/,如图所示
安装:
安装顺序
1、mysql-community-common-5.7.13-1.el6.x86_64.rpm
2、mysql-community-libs-5.7.13-1.el6.x86_64.rpm
3、mysql-community-libs-compat-5.7.13-1.el6.x86_64.rpm
4、mysql-community-client-5.7.13-1.el6.x86_64.rpm
5、mysql-community-server-5.7.13-1.el6.x86_64.rpm[root@iZ25av9xi4hZ opt]# rpm -ivh mysql-community-common-5.7.13-1.el6.x86_64.rpm warning: mysql-community-common-5.7.13-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY Preparing... ########################################### [100%] 1:mysql-community-common ########################################### [100%] [root@iZ25av9xi4hZ opt]# rpm -ivh mysql-community-libs-5.7.13-1.el6.x86_64.rpm warning: mysql-community-libs-5.7.13-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY Preparing... ########################################### [100%] 1:mysql-community-libs ########################################### [100%] [root@iZ25av9xi4hZ opt]# rpm -ivh mysql-community-libs-compat-5.7.13-1.el6.x86_64.rpm warning: mysql-community-libs-compat-5.7.13-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY Preparing... ########################################### [100%] 1:mysql-community-libs-co########################################### [100%] [root@iZ25av9xi4hZ opt]# rpm -ivh mysql-community-client-5.7.13-1.el6.x86_64.rpm warning: mysql-community-client-5.7.13-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY Preparing... ########################################### [100%] 1:mysql-community-client ########################################### [100%] [root@iZ25av9xi4hZ opt]# rpm -ivh mysql-community-server-5.7.13-1.el6.x86_64.rpm warning: mysql-community-server-5.7.13-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY Preparing... ########################################### [100%] 1:mysql-community-server ########################################### [100%] [root@f90140fd8427 lib]# useradd mysql [root@f90140fd8427 lib]# su mysql [mysql@f90140fd8427 lib]$ mysqld --initialize
二、启动mysql[root@iZ25av9xi4hZ opt]# /etc/init.d/mysqld start Initializing MySQL database: [ OK ] Installing validate password plugin: [ OK ] Starting mysqld: [ OK ]
查找mysql[root@iZ25av9xi4hZ local]# find / -name mysql -print
/usr/lib64/mysql
/usr/share/mysql mysql默认安装目录:/usr/share/mysql
/usr/bin/mysql
/etc/logrotate.d/mysql
/var/lib/mysql data默认目录:/var/lib/mysql
/var/lib/mysql/mysql
三、修改密码
3.1修改配置文件,第一次跳过验证
3.2修改my.cnf配置文件# sudo vi /etc/my.cnf
在[mysqld]的段中加上一句:skip-grant-tables,
如下:
[mysqld] datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
skip-grant-tables
3.3启动mysql#/etc/init.d/mysqld start 如果/etc/init.d/mysqld 则采用下面的方式 [root@f90140fd8427 mysql]# su mysql [mysql@f90140fd8427 mysql]$ mysqld & [1] 983 [mysql@f90140fd8427 mysql]$ exit exit [root@f90140fd8427 mysql]# ps -ef | grep mysql mysql 983 1 3 06:59 ? 00:00:00 mysqld root 1013 773 0 06:59 ? 00:00:00 grep --color=auto mysql [root@f90140fd8427 mysql]# mysql -uroot Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 2 Server version: 5.7.15 MySQL Community Server (GPL) Copyright (c) 2000, 2016, 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>
3.4 登录修改密码# mysql -uroot mysql MySQL 5.7.6 以及最新版本: # mysql> update user set authentication_string=PASSWORD('newpass') where User='root'; MySQL 5.7.5 或更早之前的版本r: # mysql> update user set password=PASSWORD('newpass') where User='root';FLUSH PRIVILEGES;
3.5修改外网权限
针对所有服务器都可以访问,修改成这样GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'mypassword' WITH GRANT OPTION;
如果只针对能192.168.13.56服务器能够访问,修改成这样GRANT ALL PRIVILEGES ON *.* TO 'root'@'192.168.13.56' IDENTIFIED BY 'mypassword' WITH GRANT OPTION;
3.6刷新数据库FLUSH PRIVILEGES;
3.7退出,修改/etc/my.cnf,删除原先的跳过验证,skip-grant-tables,删除
3.8 重启 数据库#/etc/init.d/mysqld restart
3.9如果出现下面情况
You must reset your password using ALTER USER statement before executing this statement.bogon:~ root# mysql -uroot -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 112 Server version: 5.7.14 Copyright (c) 2000, 2016, 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> use mysql ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
解决方案mysql> SET PASSWORD = PASSWORD("123456"); Query OK, 0 rows affected, 1 warning (0.01 sec) mysql> FLUSH PRIVILEGES;
相关文章推荐
- Mysql导入导出数据库以及数据表
- MyBatis Mysql 批量插入
- MYSQL 无法启动 3534
- MYSQL 5.7 修改密码
- 如何安装mysql
- Flume 抓取日志文件存入MySQL中
- MySQL存储过程
- MySQL数据库优化
- mysql 日志使用简介-错误日志,查询日志,慢查询日志,二进制日志
- HOSt ip is not allowed to connect to this MySql server
- erlang_mysql_driver 源码分析2
- 数据切分——Atlas读写分离Mysql集群的搭建
- Mysql基础笔记
- mysql存储引擎比较
- MYSQL 体系结构图-space结构图
- mysql源码分析
- MySQL必知必会笔记(六)存储过程 游标 触发器
- mysql数据备份
- MySQL知识点整理
- mysql 的存储过程