环境是centos6.x。相信其他的也大同小异。
相对来说这种方式我用的比较多。
一些环境依赖表库:
yum install perl
yum install libaio
1)下载:
在mysql的网站上,下载 mysql-5.6.13-linux-glibc2.5-x86_64.tar.gz
我的百度下载地址:http://pan.baidu.com/s/1o8NDHUi 如链接无效,可联系我。
比如拷贝到 /tmp 目录下。
2)解压:
[root@server local]#cd /usr/local
[root@server local]#tar -xvzf /tmp/mysql-5.6.13-linux-glibc2.5-x86_64.tar.gz
3)更改名字
[root@server local]#mv mysql-5.6.13-linux-glibc2.5-x86_64 mysql
4)建立mysql相关的用户和组:
[root@server local]#groupadd mysql
[root@server local]#useradd -r -g mysql mysql
5)生成数据库:
[root@server local]# cd mysql
[root@server local]# chown -R mysql .
[root@server local]# chgrp -R mysql .
[root@server local]# mkdir -p /data/mysql/data
[root@server local]# scripts/mysql_install_db --user=mysql --datadir=/data/mysql/data
[root@server local]# chown -R root .
[root@server local]# chown -R mysql.mysql /data/mysql/
6)拷贝必要的文件(此为可选步骤):
[root@server local]#cp support-files/mysql.server /etc/init.d/mysql.server
7)启动数据库:
[root@server local]#/etc/init.d/mysql.server start
8) 配置文件 /etc/my.cnf
[mysqld]
datadir=/data/mysql/data
socket=/data/mysql/mysql.sock
log-bin = /data/mysql/binlog
user=mysql
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0yu
[mysqld_safe]
log-error=/data/mysql/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
[mysql]
#default-character-set=utf8
socket=/data/mysql/mysql.sock
9) 要在/data/mysql 下创建目录
binlog
data
log
10) ln 一个客户端出来。 ln -n /usr/local/mysql/bin/mysql /usr/local/sbin/mysql
添加所有用户都是可能访问的方法:
>GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'uOvnHX1XmAYIowKd' WITH GRANT OPTION;
>FLUSH PRIVILEGES;
GRANT ALL PRIVILEGES ON *.* TO 'firenote'@'%' IDENTIFIED BY 'kingsoft' WITH GRANT OPTION;
update user set host='%' where host='localhost' and user='root';