记录安装mysql 5.6的全过程

下载安装包(尝试过使用mysql的yum源去安装--如果你的网络够好的话。。。)

注:我的系统是Centos 7.2的 如下,根据自己的需求去下载

CentOS Linux release 7.2.1511 (Core)
3.10.0-327.el7.x86_64

下载下面的rpm 捆绑包,下载这一个

Centos服务器上安装MySQL依赖包

yum -y install perl perl-devel net-tools

将下载好的捆绑包上传到服务器

解压

[root@WCY mysql56]# ls
MySQL-5.6.41-1.el7.x86_64.rpm-bundle.tar
[root@WCY mysql56]# tar xf MySQL-5.6.41-1.el7.x86_64.rpm-bundle.tar
[root@WCY mysql56]# ls
MySQL-5.6.41-1.el7.x86_64.rpm-bundle.tar MySQL-embedded-5.6.41-1.el7.x86_64.rpm MySQL-shared-compat-5.6.41-1.el7.x86_64.rpm
MySQL-client-5.6.41-1.el7.x86_64.rpm MySQL-server-5.6.41-1.el7.x86_64.rpm MySQL-test-5.6.41-1.el7.x86_64.rpm
MySQL-devel-5.6.41-1.el7.x86_64.rpm MySQL-shared-5.6.41-1.el7.x86_64.rpm

创建MySQL用户与组

useradd -M -s /sbin/nologin mysql

安装

rpm -ivh MySQL-client-5.6.41-1.el7.x86_64.rpm
rpm -ivh MySQL-shared-5.6.41-1.el7.x86_64.rpm
rpm -ivh MySQL-devel-5.6.41-1.el7.x86_64.rpm
rpm -ivh MySQL-shared-compat-5.6.41-1.el7.x86_64.rpm
rpm -ivh MySQL-embedded-5.6.41-1.el7.x86_64.rpm
rpm -ivh MySQL-test-5.6.41-1.el7.x86_64.rpm
rpm -ivh MySQL-server-5.6.41-1.el7.x86_64.rpm

创建mysql配置文件my.cnf

[root@WCY ~]# cp /usr/share/mysql/my-default.cnf /etc/my.cnf

初始化MySQL

[root@WCY ~]# /usr/bin/mysql_install_db
FATAL ERROR: please install the following Perl modules before executing /usr/bin/mysql_install_db:
Data::Dumper

报错解决:

[root@WCY ~]# yum install -y perl-Module-Install.noarch

解决完报错别忘了 再执行初始化

启动MySQL

[root@WCY ~]# systemctl start mysql
Job for mysql.service failed because the control process exited with error code. See "systemctl status mysql.service" and "journalctl -xe" for details.

启动报错,查看下

[root@WCY ~]# journalctl -xe
9月 20 21:25:03 WCY.local yum[18450]: Installed: perl-HTTP-Daemon-6.01-7.el7.noarch
9月 20 21:25:03 WCY.local yum[18450]: Installed: perl-HTTP-Negotiate-6.01-5.el7.noarch ································· 9月 20 21:31:18 WCY.local mysql[18635]: Starting MySQL. ERROR! The server quit without updating PID file (/var/lib/mysql/WCY.local.pid).
9月 20 21:31:18 WCY.local systemd[1]: mysql.service: control process exited, code=exited status=1
9月 20 21:31:18 WCY.local systemd[1]: Failed to start LSB: start and stop MySQL.

可以看到

ERROR! The server quit without updating PID file (/var/lib/mysql/WCY.local.pid).

先设置下目录权限

[root@WCY ~]# chown -R mysql:mysql /var/lib/mysql/

再启动

[root@WCY ~]# systemctl start mysql.service
[root@WCY ~]# netstat -anpt | grep mysql
tcp6 0 0 :::3306 :::* LISTEN 18891/mysqld

已启动

设置MySQL密码

[root@WCY ~]# /usr/bin/mysqladmin -u root password 'mima'

‘mima’替换为你要设置的密码

如果你的系统版本是CentOS6.x的

安装完MySQL5.6.x后密码为自动生成的保存在本用户目录下隐藏文件.mysql_secret

[root@Check1 ~]# cat .mysql_secret
# The random password set for the root user at Sat Oct 20 11:37:06 2018 (local time): c5SoTcrXmMYFBMsU

更改root密码

[root@Check1 ~]# mysql -uroot -pc5SoTcrXmMYFBMsU    使用生成的密码登录数据库测试一下
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 8
Server version: 5.6.41 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> quit
Bye
[root@Check1 ~]# mysqladmin -uroot -p password '123123' 设置新的密码为123123 回车后输入上面生成的密码
Enter password:
Warning: Using a password on the command line interface can be insecure.
[root@Check1 ~]# mysql -uroot -p123123 用新密码登录
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 10
Server version: 5.6.41 MySQL Community Server (GPL) 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>

安装结束,优化后续再说。。。

安装MySQL 5.6的更多相关文章

  1. Centos6.5下编译安装mysql 5.6

    一:卸载旧版本 使用下面的命令检查是否安装有MySQL Server rpm -qa | grep mysql 有的话通过下面的命令来卸载掉 rpm -e mysql //普通删除模式 rpm -e ...

  2. 在Ubuntu 16.10安装mysql workbench报未安装软件包 libpng12-0错误

    1.安装mysql workbench,提示未安装软件包 libpng12-0 下载了MySQL Workbench 6.3.8   在安装的时候报错: -1ubu1604-amd64.deb 提示: ...

  3. ubuntu安装mysql

    好记性不如烂笔头,记录一下,ubuntu安装mysql的指令. 安装MySQL: sudo apt-get install mysql-server sudo apt-get install mysq ...

  4. Linux1 在Linux(CentOS)上安装MySql详细记录

    前记:  毕业两年了,前两天换了份工作,由以前的传统行业跳到了互联网行业.之前的公司一直在用WinServer2003+Tomcat+SqlServer/Oracle这套部署环境.对于Linux+To ...

  5. PHP安装mysql.so扩展

    在PHP中mysql_connect模块已经逐渐被弃用,我在搭建环境时也没有再安装mysql扩展,但是今天在维护一个老项目时,出现报错 Fatal error: Uncaught Error: Cal ...

  6. 安装MySql for Visual Studio的坑

    阅读目录 问题描述 解决过程 解决方案 总结 回到顶部 问题描述 安装MySql for Visual Studio 一般来说是为了能在VS的服务器数据连接的数据源中能选择MySql类型,如下图: 但 ...

  7. CentOS 7 安装MySQL 5.6遇到的疑难杂症小结

    在一测试服务器(CentOS Linux release 7.2.1511)上安装MySQL 5.6(5.6.19 MySQL Community Server)时遇到下面错误,这个是因为CentOS ...

  8. Mac上安装MySQL记录

    下载最新的MySQL社区版 官方下载地址:http://dev.mysql.com/downloads/mysql/ 为了安装更方便,建议下载dmg安装包. 最新的版本是5.7.9. 安装MySQL ...

  9. linux 安装mysql数据库——yum安装法

    mysql数据库有多种安装方式,本文只介绍在Linux服务器上最实用.最快捷的mysql server安装方法.一.Linux服务器yum安装(CentOS6.3 64位) 所有在服务器上执行的命令, ...

  10. 二进制包安装MySQL数据库

    1.1二进制包安装MySQL数据库 1.1.1 安装前准备(规范) [root@Mysql_server ~]# mkdir -p /home/zhurui/tools ##创建指定工具包存放路径 [ ...

随机推荐

  1. eclipse ${user}和${date}

    在Eclipse中使用类的自动注释时,@author ${user}, 这个值不会随着你更改系统用户名而改变.有的人会将这个 ${user} 变量直接替换为某个固定名称. 以下方法可以修改它的值. 在 ...

  2. acdream1415(dij+优先队列+桥)

    这题好坑,卡SPFA... 无奈只能用dij+优先队列了. 因为好久没有写过代码了,所以今天写dij时候突然觉得复杂度不对,dij+优先队列的复杂度是(n+m)logn,这种复杂度对于稠密图是非常慢! ...

  3. [LintCode] 最后一个单词的长度

    class Solution { public: /** * @param s A string * @return the length of last word */ int lengthOfLa ...

  4. 使用MAP文件快速定位程序崩溃代码行 (转)

    使用MAP文件快速定位程序崩溃代码行 =========================================================== 作者: lzmfeng(http://lz ...

  5. HDU 1695 GCD (欧拉函数,容斥原理)

    GCD Time Limit: 6000/3000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submis ...

  6. 微信公众号 拼团到期人数不足 db触发器 js触发器 剥离

    w注意当页面多个先后到期或同时到期的团时的用户体验 w保证了每次加载这个页面会是的过期的团不显示,马上到期的团会在页面存活期间进行页面更新和db操作: 但是这依赖了团状态值的更新必须依赖于有客户端页面 ...

  7. 模块 - time/datetime

    time 模块 time模块方法: >>> import time >>> time.time() #时间戳 秒级别 1519212085.6211221 #从19 ...

  8. Java 之 Servlet

    JavaWeb 三大组件: Servlet, Filter, Listener. Servlet 的作用是处理请求,服务器会把接收到的请求交给 Servlet 来处理.在 Servlet 中通常需要: ...

  9. Line---CodeForces 7C(扩展欧几里得算法)

    题目链接:http://codeforces.com/problemset/problem/7/C AX+BY=C已知 A B C 求 X Y: #include <iostream> # ...

  10. 笔记-django学习链接

    form表单学习 https://www.cnblogs.com/weiman3389/p/6225075.html python字符串replace()方法 https://www.cnblogs. ...