linuxsir首页 LinuxSir.Org | Linux、BSD、Solaris、Unix | 开源传万世,因有我参与欢迎您!
网站首页 | 设为首页 | 加入收藏
您所在的位置:主页 > Linux数据库 >

Linux下安装MySQL 5.7.11

时间:2016-11-11  来源:未知  作者:linuxsir首页

Linux下安装MySQL 5.7.11

拷贝mysql5.7安装包

bash-4.1# cp /mnt/hgfs/Downloads/mysql-5.7.11-1.el6.x86_64.rpm-bundle.tar /home
解压安装包
bash-4.1# tar -xvf mysql-5.7.11-1.el6.x86_64.rpm-bundle.tar 
mysql-community-embedded-5.7.11-1.el6.x86_64.rpm
mysql-community-common-5.7.11-1.el6.x86_64.rpm
mysql-community-test-5.7.11-1.el6.x86_64.rpm
mysql-community-client-5.7.11-1.el6.x86_64.rpm
mysql-community-embedded-devel-5.7.11-1.el6.x86_64.rpm
mysql-community-server-5.7.11-1.el6.x86_64.rpm
mysql-community-devel-5.7.11-1.el6.x86_64.rpm
mysql-community-libs-5.7.11-1.el6.x86_64.rpm
mysql-community-libs-compat-5.7.11-1.el6.x86_64.rpm

检查系统已经安装的mysql 包

bash-4.1# rpm -qa | grep mysql
rsyslog-mysql-4.6.2-2.el6.x86_64
php-mysql-5.3.2-6.el6.x86_64
mysql-server-5.1.47-4.el6.x86_64
mysql-connector-odbc-5.1.5r1144-7.el6.x86_64
mysql-5.1.47-4.el6.x86_64
dovecot-mysql-2.0-0.10.beta6.20100630.el6.x86_64
mysql-libs-5.1.47-4.el6.x86_64
mod_auth_mysql-3.0.0-11.el6.x86_64
qt-mysql-4.6.2-16.el6.x86_64
mysql-devel-5.1.47-4.el6.x86_64

删除原有mysql的安装包

bash-4.1# rpm -e rsyslog-mysql-4.6.2-2.el6.x86_64 --nodeps
bash-4.1# rpm -e php-mysql-5.3.2-6.el6.x86_64 --nodeps
bash-4.1# rpm -e mysql-server-5.1.47-4.el6.x86_64 --nodeps
bash-4.1# rpm -e mysql-connector-odbc-5.1.5r1144-7.el6.x86_64 --nodeps
bash-4.1# rpm -e mysql-5.1.47-4.el6.x86_64 --nodeps
bash-4.1# rpm -e dovecot-mysql-2.0-0.10.beta6.20100630.el6.x86_64 --nodeps
bash-4.1# rpm -e mysql-libs-5.1.47-4.el6.x86_64 --nodeps
bash-4.1# rpm -e mod_auth_mysql-3.0.0-11.el6.x86_64 --nodeps
bash-4.1# rpm -e qt-mysql-4.6.2-16.el6.x86_64 --nodeps
bash-4.1# rpm -e mysql-devel-5.1.47-4.el6.x86_64 --nodeps

安装mysql5.7的相关包,注意安装顺序,因为包之间有依赖。

bash-4.1# rpm -ivh mysql-community-common-5.7.11-1.el6.x86_64.rpm
warning: mysql-community-common-5.7.11-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                ########################################### [100%]
   1:mysql-community-common ########################################### [100%]
bash-4.1# 

bash-4.1# rpm -ivh mysql-community-libs-5.7.11-1.el6.x86_64.rpm
warning: mysql-community-libs-5.7.11-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                ########################################### [100%]
   1:mysql-community-libs   ########################################### [100%]
bash-4.1# 
bash-4.1# 
bash-4.1# rpm -ivh mysql-community-embedded-5.7.11-1.el6.x86_64.rpm
warning: mysql-community-embedded-5.7.11-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                ########################################### [100%]
   1:mysql-community-embedde########################################### [100%]


bash-4.1# rpm -ivh mysql-community-client-5.7.11-1.el6.x86_64.rpm
warning: mysql-community-client-5.7.11-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                ########################################### [100%]
   1:mysql-community-client ########################################### [100%]
bash-4.1# 

bash-4.1# 
bash-4.1# rpm -ivh mysql-community-server-5.7.11-1.el6.x86_64.rpm
warning: mysql-community-server-5.7.11-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                ########################################### [100%]
   1:mysql-community-server ########################################### [100%]
bash-4.1# 



bash-4.1# rpm -ivh mysql-community-devel-5.7.11-1.el6.x86_64.rpm 
warning: mysql-community-devel-5.7.11-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                ########################################### [100%]
   1:mysql-community-devel  ########################################### [100%]
bash-4.1# ll /var/lib/mysql
total 0

修改mysql的配置my.cnf ,关闭严格的密码设置,增加validate_password=OFF设置

bash-4.1# vi /etc/my.cnf

# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html

[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
#
# 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
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
validate_password=OFF



启动mysql服务

bash-4.1#
/etc/rc.d/init.d/mysqld start
Initializing MySQL database:                               [  OK  ]
Installing validate password plugin:                       [  OK  ]
Starting mysqld:                                           [  OK  ]

有时validate_password=OFF会不生效,需要重启一下mysql 服务

/etc/rc.d/init.d/mysqld restart

在mysql的安装目录下会产生相关文件

bash-4.1# ll /var/lib/mysql
total 122948
-rw-r-----. 1 mysql mysql       56 Mar 31 17:04 auto.cnf
-rw-------. 1 mysql mysql     1675 Mar 31 17:04 ca-key.pem
-rw-r--r--. 1 mysql mysql     1074 Mar 31 17:04 ca.pem
-rw-r--r--. 1 mysql mysql     1078 Mar 31 17:04 client-cert.pem
-rw-------. 1 mysql mysql     1675 Mar 31 17:04 client-key.pem
-rw-r-----. 1 mysql mysql      346 Mar 31 17:04 ib_buffer_pool
-rw-r-----. 1 mysql mysql 12582912 Mar 31 17:04 ibdata1
-rw-r-----. 1 mysql mysql 50331648 Mar 31 17:04 ib_logfile0
-rw-r-----. 1 mysql mysql 50331648 Mar 31 17:04 ib_logfile1
-rw-r-----. 1 mysql mysql 12582912 Mar 31 17:04 ibtmp1
drwxr-x---. 2 mysql mysql     4096 Mar 31 17:04 mysql
-rw-rw----. 1 root  root         6 Mar 31 17:04 mysqld_safe.pid
srwxrwxrwx. 1 mysql mysql        0 Mar 31 17:04 mysql.sock
-rw-------. 1 mysql mysql        6 Mar 31 17:04 mysql.sock.lock
drwxr-x---. 2 mysql mysql     4096 Mar 31 17:04 performance_schema
-rw-------. 1 mysql mysql     1679 Mar 31 17:04 private_key.pem
-rw-r--r--. 1 mysql mysql      451 Mar 31 17:04 public_key.pem
-rw-r--r--. 1 mysql mysql     1078 Mar 31 17:04 server-cert.pem
-rw-------. 1 mysql mysql     1675 Mar 31 17:04 server-key.pem
drwxr-x---. 2 mysql mysql    12288 Mar 31 17:04 sys

修改mysql 的root用户的登陆密码

bash-4.1# mysql -u -root -p
Enter password: 
ERROR 1045 (28000): Access denied for user '-root'@'localhost' (using password: NO)
bash-4.1# 
bash-4.1# /etc/rc.d/init.d/mysqld stop
Stopping mysqld:                                           [  OK  ]
bash-4.1# mysqld_safe --user=mysql --skip-grant-tables --skip-networking &
[1] 10436
bash-4.1# 2016-03-31T09:06:56.496531Z mysqld_safe Logging to '/var/log/mysqld.log'.
2016-03-31T09:06:56.613061Z mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql

bash-4.1# mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.11 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> use mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> UPDATE user SET authentication_string=PASSWORD('zcxc123') where USER='root';
Query OK, 1 row affected, 1 warning (0.00 sec)
Rows matched: 1  Changed: 1  Warnings: 1

mysql> quit
Bye
bash-4.1# etc/rc.d/init.d/mysqld restart


进入mysql后,第一件事件就是要你改默认密码,由于已经关闭v
alidate_password功能,因此可以设置简单的密码

[root@c12 mysql57]# ./bin/mysql -u root -p
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
mysql> set password = password('zcxc1234')

本文永久更新链接地址:http://www.linuxidc.com/Linux/2016-11/136832.htm

linux
友情链接
  • Mozilla发布Firefox 67.0.4,修复沙箱逃逸漏洞
  • 蚂蚁金服正式成为CNCF云原生计算基金会黄金会员
  • Firefox 68将采用Microsoft BITS安装更新
  • OpenSSH增加对存储在RAM中的私钥的保护
  • 谷歌想实现自己的curl,为什么?
  • Raspberry Pi 4发布:更快的CPU、更大的内存
  • Firefox的UA将移除CPU架构信息
  • Ubuntu放弃支持32位应用程序实属乌龙,Steam会否重回Ubuntu怀抱
  • Qt 5.13稳定版发布:引入glTF 2.0、改进Wayland以及支持Lottie动
  • 红帽企业Linux 7现已内置Redis 5最新版
  • Slack进入微软内部禁用服务清单,GitHub也在其列?
  • 安全的全新编程语言V发布首个可用版本
  • Windows Terminal已上架,快尝鲜
  • 阿里巴巴微服务开源生态报告No.1
  • 面世两年,Google地球将支持所有基于Chromium的浏览器
  • 推进企业容器化持续创新,Rancher ECIC千人盛典完美收官
  • CentOS 8.0最新构建状态公布,或于数周后发布
  • Debian移植RISC
  • 微软拆分操作系统的计划初现雏形
  • Oracle发布基于VS Code的开发者工具,轻松使用Oracle数据库
  • Ubuntu 19.10停止支持32位的x86架构
  • 微软为Windows Terminal推出全新logo
  • 联想ThinkPad P系列笔记本预装Ubuntu系统
  • 微软发布适用于Win7/8的Microsoft Edge预览版
  • 启智平台发布联邦学习开源数据协作项目OpenI纵横
  • 经过六个多月的延迟,微软终于推出Hyper
  • ZFS On Linux 0.8.1 发布,Python可移植性工作
  • DragonFly BSD 5.6.0 发布,HAMMER2状态良好
  • Linux Kernel 5.2
  • CentOS 8.0 看起来还需要几周的时间
  • 百度网盘Linux版正式发布
  • PCIe 6.0宣布:带宽翻倍 狂飙至256GB/s
  • PHP 7.4 Alpha 发布,FFI扩展,预加载Opcache以获得更好的性能
  • Canonical将在未来的Ubuntu版本中放弃对32位架构的支持
  • Scala 2.13 发布,改进的编译器性能
  • 微软的GitHub收购了Pull Panda,并且使所有订阅完全免费
  • Windows Subsystem for Linux 2 (WSL 2)现在适用于Windows 10用
  • Debian 10 “Buster”的RISC
  • MariaDB宣布发布MariaDB Enterprise Server 10.4
  • DXVK 1.2.2 发布,带来微小的CPU开销优化
  • DragonFlyBSD 5.6 RC1 发布,VM优化,默认为HAMMER2
  • PrimeNG 8.0.0 发布,支持Angular 8,FocusTrap等
  • GIMP 2.10.12 发布,一些有用的改进
  • 清华大学Anaconda 镜像服务即将恢复
  • Debian GNU/Linux 10 “Buster” 操作系统将于2019年7月6日发布
  • 时时彩论坛
  • 五星体育斯诺克
  • 北单比分直播
  • 河北11选5走势图
  • 福建体彩36选7开奖结果
  • 九龙图库下载