下载地址:

http://cdn.MySQL.com/archives/mysql-5.6/MySQL-server-5.6.13-1.el6.x86_64.rpm
http://cdn.mysql.com/archives/mysql-5.6/MySQL-devel-5.6.13-1.el6.x86_64.rpm
http://cdn.mysql.com/archives/mysql-5.6/MySQL-client-5.6.13-1.el6.x86_64.rpm

 

RedHat 6.3下安装MySQL-server-5.6.13-1.el6.x86_64.rpm

首先下载下面三个文件:

MySQL-client-5.6.13-1.el6.x86_64.rpm
MySQL-devel-5.6.13-1.el6.x86_64.rpm
MySQL-server-5.6.13-1.el6.x86_64.rpm

然后使用root账号登陆,进行安装:

1. 安装server、devel、client:1. 安装server、devel、client:

rpm -ivh --replacefiles MySQL-s*.rpm

rpm -ivh --replacefiles MySQL-d*.rpm

rpm -ivh --replacefiles MySQL-c*.rpm

发现缺libaio.so包
error: Failed dependencies:
/usr/bin/perl is needed by MySQL-server-5.6.22-1.el6.x86_64
libaio.so.1()(64bit) is needed by MySQL-server-5.6.22-1.el6.x86_64
libaio.so.1(LIBAIO_0.1)(64bit) is needed by MySQL-server-5.6.22-1.el6.x86_64
libaio.so.1(LIBAIO_0.4)(64bit) is needed by MySQL-server-5.6.22-1.el6.x86_64
error: Failed dependencies:
/usr/bin/perl is needed by MySQL-server-5.6.22-1.el6.x86_64
解决方法
[root@xcldtc5m mysql]# yum install libaio
[root@xcldtc5m mysql]# yum install perl

[root@localhost download]# rpm -ivh --replacefiles MySQL-server-5.6.13-1.el6.x86_64.rpm  
Preparing...                ########################################### [100%]  
  1:MySQL-server          ########################################### [100%]  
[root@localhost download]# rpm -ivh --replacefiles MySQL-client-5.6.13-1.el6.x86_64.rpm  
Preparing...                ########################################### [100%]  
  1:MySQL-client          ########################################### [100%]  
[root@localhost download]# rpm -ivh --replacefiles MySQL-devel-5.6.13-1.el6.x86_64.rpm  
Preparing...                ########################################### [100%]  
  1:MySQL-devel            ########################################### [100%]

要移除安装可以使用 rpm -e MySQL-server  、 rpm -e MySQL-devel、MySQL-client即可;

2. 初始化数据库

/usr/bin/mysql_install_db

3. 启动mysql服务:

service mysql start

使用命令ps -ef | grep mysql 查看mysql进程:

[root@localhost ~]# ps -ef | grep mysql  
root    26047    1  0 18:14 pts/12  00:00:00 /bin/sh /usr/bin/mysqld_safe --datadir=/var/lib/mysql --pid-file=/var/lib/mysql/localhost.localdomain.pid  
mysql    26227 26047  0 18:14 pts/12  00:00:01 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --user=mysql --log-error=/var/log/mysqld.log --pid-file=/var/lib/mysql/localhost.localdomain.pid --socket=/var/lib/mysql/mysql.sock  
root    26545 24726  0 18:27 pts/8    00:00:00 grep mysql

4.第一次登陆设置root密码:

首先查看 cat /root/.mysql_secret

root@localhost ~]# cat /root/.mysql_secret  
# The random password set for the root user at Fri Aug 30 15:57:18 2013 (local time): fMYcarvB

然后命令行:mysql -u root -p ,然后输入上面的密码即可:

[root@localhost ~]# mysql -u root -p  
Enter password:  
Welcome to the MySQL monitor.  Commands end with ; or \g.  
Your MySQL connection id is 5  
Server version: 5.6.13 MySQL Community Server (GPL)  
  
Copyright (c) 2000, 2013, 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.

设置root密码:

SET PASSWORD=password('123456');

退出,重新登陆即可使用新的密码登陆;

5. 设置远程登陆:

使用root登陆到mysql后

mysql> update user set host='%' where user='root';  
ERROR 1062 (23000): Duplicate entry '%-root' for key 'PRIMARY'  
mysql> select host,user from user;  
+-----------------------+------+  
| host                  | user |  
+-----------------------+------+  
| %                    | root |  
| 127.0.0.1            | root |  
| 192.168.128.142      | root |  
| ::1                  | root |  
| localhost.localdomain | root |  
+-----------------------+------+  
5 rows in set (0.00 sec)

然后:

mysql> grant all privileges on *.* to 'root'@'%' with grant option;  
Query OK, 0 rows affected (0.08 sec)  
  
mysql> exit  
Bye  
[root@localhost ~]# service mysql restart  
Shutting down MySQL.. SUCCESS!  
Starting MySQL.. SUCCESS!  
重启mysql即可远程登陆。

如果远程还是无法连接,请检查防火墙是否开启

/etc/init.d/iptables  status

如果开启 请关闭

/etc/init.d/iptables stop

###########################################################

RPM方式安装MySQL5.6

a. 检查MySQL及相关RPM包,是否安装,如果有安装,则移除(rpm –e 名称)

1 [root@localhost ~]# rpm -qa | grep -i mysql
2 mysql-libs-5.1.66-2.el6_3.x86_64
3 [root@localhost ~]# yum -y remove mysql-libs*

b. 下载Linux对应的RPM包,如:CentOS6.4_64对应的RPM包,如下:

1 [root@localhost rpm]# ll
2 total 74364
3 -rw-r--r--. 1 root root 18442536 Dec 11 20:19 MySQL-client-5.6.15-1.el6.x86_64.rpm
4 -rw-r--r--. 1 root root  3340660 Dec 11 20:06 MySQL-devel-5.6.15-1.el6.x86_64.rpm
5 -rw-r--r--. 1 root root 54360600 Dec 11 20:03 MySQL-server-5.6.15-1.el6.x86_64.rpm

c. 安装MySQL

1 [root@localhost rpm]# rpm -ivh MySQL-server-5.6.15-1.el6.x86_64.rpm
2 [root@localhost rpm]# rpm -ivh MySQL-devel-5.6.15-1.el6.x86_64.rpm
3 [root@localhost rpm]# rpm -ivh MySQL-client-5.6.15-1.el6.x86_64.rpm
4 #修改配置文件位置
5 [root@localhost rpm]# cp /usr/share/mysql/my-default.cnf /etc/my.cnf

d. 初始化MySQL及设置密码

1 [root@localhost rpm]# /usr/bin/mysql_install_db
2 [root@localhost rpm]# service mysql start
3 [root@localhost rpm]# cat /root/.mysql_secret  #查看root账号密码
4 # The random password set for the root user at Wed Dec 11 23:32:50 2013 (local time): qKTaFZnl
5 [root@localhost ~]# mysql -uroot –pqKTaFZnl
6 mysql> SET PASSWORD = PASSWORD('123456');    #设置密码为123456
7 mysql> exit
8 [root@localhost ~]# mysql -uroot -p123456

e. 允许远程登陆

01 mysql> use mysql;
02 mysql> select host,user,password from user;
03 +-----------------------+------+-------------------------------------------+
04 | host                  | user | password                                  |
05 +-----------------------+------+-------------------------------------------+
06 | localhost             | root | *6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9 |
07 | localhost.localdomain | root | *1237E2CE819C427B0D8174456DD83C47480D37E8 |
08 | 127.0.0.1             | root | *1237E2CE819C427B0D8174456DD83C47480D37E8 |
09 | ::1                   | root | *1237E2CE819C427B0D8174456DD83C47480D37E8 |
10 +-----------------------+------+-------------------------------------------+
11  
12 mysql> update user set password=password('123456') where user='root';
13 mysql> update user set host='%' where user='root' and host='localhost';
14 mysql> flush privileges;
15 mysql> exit

f. 设置开机自启动

1 [root@localhost ~]# chkconfig mysql on
2 [root@localhost ~]# chkconfig --list | grep mysql
3 mysql           0:off   1:off   2:on    3:on    4:on    5:on    6:off

g. MySQL的默认安装位置

1 /var/lib/mysql/               #数据库目录
2 /usr/share/mysql              #配置文件目录
3 /usr/bin                     #相关命令目录
4 /etc/init.d/mysql              #启动脚本

修改字符集和数据存储路径

配置/etc/my.cnf文件,修改数据存放路径、mysql.sock路径以及默认编码utf-8.

  1. [client]
  2. password        = 123456
  3. port            = 3306
  4. default-character-set=utf8
  5. [mysqld]
  6. log-error=/usr/mysql.log  #启动错误日志,没设置的话默认在 /usr/mysql.log
  7. port            = 3306
  8. character_set_server=utf8
  9. character_set_client=utf8
  10. collation-server=utf8_general_ci
  11. #(注意linux下mysql安装完后是默认:表名区分大小写,列名不区分大小写; 0:区分大小写,1:不区分大小写)
  12. lower_case_table_names=1
  13. #(设置最大连接数,默认为 151,MySQL服务器允许的最大连接数16384; )
  14. max_connections=1000
  15. [mysql]
  16. default-character-set = utf8

查看字符集

show variables like '%collation%';

show variables like '%char%';

###########################################################

windows下安装mysql解压版

在windows下安装mysql解压版很简单,分分钟的事情,但是要使用好mysql,还是要多加以练习才行。下面说下安装步骤。

1、到官网下载最新的mysql版本,并解压到任意路径,比如:D:\Program Files\mysql\mysql-5.6.11-win32

2、设置环境变量:新建变量名:MYSQL_HOME,值为你解压的路径:D:\Program Files\mysql\mysql-5.6.11-win32

3、然后在系统变量path中添加:“;%MYSQL_HOME%\bin“,

4、打开mysql根目录,会发现有my-default.ini文件,复制然后重命名为my.ini

5、在my.ini中添加如下内容:

[mysqld]
#设置字符集为utf8
loose-default-character-set = utf8
basedir = D:/Program Files/mysql/mysql-5.6.11-win32
datadir = D:/Program Files/mysql/mysql-5.6.11-win32/data [client]
loose-default-character-set = utf8 [mysql]
loose-default-character-set = utf8 [WinMySQLadmin]
server = D:/Program Files/mysql/mysql-5.6.11-win32/bin/mysqld.exe

6、打开命令提示符,切换到D:\Program Files\mysql\mysql-5.6.11-win32\bin目录下,然后执行mysqld -install安装mysql服务。执行成功后会提示:service successfully installed。如果想卸载mysql服务,执行mysqld -remove即可。

7、启动mysql服务:net start mysql

8、默认情况下root是空密码,给root设置密码:mysqladmin -u root -p password "新密码"

9、然后在命令提示符下执行mysql命令既可进入mysql,然后进行各种操作(建表、查询之类的)

最后推荐两篇mysql操作连接:

1、快速入门:http://www.cnblogs.com/mr-wid/archive/2013/05/09/3068229.html#c4

2、深入研究:http://dev.mysql.com/doc/refman/5.1/zh/tutorial.html#database-use

RPM方式安装MySQL5.6和windows下安装mysql解压版的更多相关文章

  1. windows(win10)下的mysql解压版安装

    1. 到mysql官网 下载mysql : http://dev.mysql.com/downloads/mysql/   ,会提示登陆,注册一个就行了,公司名什么的随便填. 注意区分32,64位.我 ...

  2. windows下tomcat zip解压版安装方法

    下面记录一下在win7(32位)系统下,安装zip解压版的方法: 一.下载zip压缩包 地址:http://tomcat.apache.org/download-80.cgi 二.解压 我把解压包解压 ...

  3. windows下MySQL解压版安装

    MySQL的安装 一.前期准备 获取MySQL解压版安装包(本文使用的是 [mysql-5.7.28-winx64.zip]版本) 获取方式: 通过官网下载,官方下载地址:“https://dev.m ...

  4. tar.xz如何解压:linux和windows下tar.xz解压命令介绍

    在linux下怎么解压和压缩tar.xz文件? (本文由www.169it.com搜集整理) 在linux下解压tar.xz文件步骤 1 2 # xz -d ***.tar.xz  //先解压xz # ...

  5. Windows系统下MySQL添加到系统服务方法(mysql解压版)

    MySQL软件版本:64位 5.7.12 1.首先配置MySQL的环境变量,在系统环境变量Path的开头添加MySQL的bin目录的路径,以“;”结束,我的路径配置如下: 2.修改MySQL根目录下的 ...

  6. MySQL解压版安装配置

    官网下载地址:http://dev.mysql.com/downloads/windows/installer/ (可以选择解压版zip下载,也可以选择msi安装版.) 解压zip版配置: 1. 下载 ...

  7. mysql解压版服务启动方式

    使用mysql解压版,在不安装为windows服务时,使用下面的方式启动. 1.打开命令行,首先进入mysql解压目录的bin目录下 d:\mysql\bin 2.输入mysqld --console ...

  8. MySQL踩坑及MySQL解压版安装

    MySQL默认当前时间: MySQL5.5版本以下是不支持:datetime default now() 的,只能写成 timestamp default now() ; 而MySQL5.6以上是支持 ...

  9. MySQL解压版安装配置详解

    MySQL解压版安装起来比较简单,步骤相对较少.下面我们就来详细介绍一下如何在windows操作系统上安装解压班的MySQL. 1.下载解压版MySQL,地址:http://downloads.mys ...

随机推荐

  1. sorttable

    http://rubaxa.github.io/Sortable/Sortable.js http://rubaxa.github.io/Sortable/Sortable.min.jshttp:// ...

  2. UE4 异步资源加载

    http://blog.csdn.net/pizi0475/article/details/48178861 http://blog.sina.com.cn/s/blog_710ea1400102vl ...

  3. Mybatis-动态 SQL

    MyBatis 的强大特性之一便是它的动态 SQL. 如果你有使用 JDBC 或其他类似框架的经验,你就能体会到根据不同条件拼接 SQL 语句有多么痛苦.拼接的时候要确保不能忘了必要的空格,还要注意省 ...

  4. 基于MPI的并行计算—矩阵向量乘

    以前没接触过MPI编程,对并行计算也没什么了解.朋友的期末课程作业让我帮忙写一写,哎,实现结果很一般啊.最终也没完整完成任务,惭愧惭愧. 问题大概是利用MPI完成矩阵和向量相乘.输入:Am×n,Bn× ...

  5. SQLite手工注入方法小结

    SQLite 官网下载:www.sqlite.org/download.html sqlite管理工具:http://www.yunqa.de/delphi/products/sqlitespy/in ...

  6. MyBatis架构(转)

    本文来自http://www.bubuko.com/infodetail-549184.html 如果不太熟悉MyBatis使用的请先参见MyBatis官方文档,这对理解其架构设计和源码分析有很大好处 ...

  7. AndroidStudio 中的坑Error:(1, 0) Plugin is too old, please update to a more recent version, or set ANDROID_DAILY_OVERRID

    将 build.gradle 中 的 classpath改为2.0.+ dependencies { classpath 'com.android.tools.build:gradle:2.0.+'然 ...

  8. C# 中Join( )的理解

    在MSDN中对Join( )的解释比较模糊:在继续执行标准的 COM 和 SendMessage 消息泵处理期间,阻塞调用线程(线程A),直到某个线程终(线程B)止为止. 首先来看一下有关的概念: 我 ...

  9. 常见C内存管理程序

    本文主要关注的是C内存管理程序,比较著名的几个C内存管理程序,其中包括: l   Doug Lea Malloc:Doug Lea Malloc实际上是完整的一组分配程序,其中包括Doug Lea的原 ...

  10. phpunit4.1的干净测试

    一般而言,写测试时需要加载一些文件来进行自动加载 但在phpunit4.1中只要其中一个测试文件加载了,其他测试文件就不需要再加载