环境是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)解压:
[[email protected] local]#cd /usr/local
[[email protected] local]#tar -xvzf /tmp/mysql-5.6.13-linux-glibc2.5-x86_64.tar.gz
3)更改名字
[[email protected] local]#mv mysql-5.6.13-linux-glibc2.5-x86_64 mysql
4)建立mysql相关的用户和组:
[[email protected] local]#groupadd mysql
[[email protected] local]#useradd -r -g mysql mysql
5)生成数据库:
[[email protected] local]# cd mysql
[[email protected] local]# chown -R mysql .
[[email protected] local]# chgrp -R mysql .
[[email protected] local]# mkdir -p /data/mysql/data
[[email protected] local]# scripts/mysql_install_db –user=mysql –datadir=/data/mysql/data
[[email protected] local]# chown -R root .
[[email protected] local]# chown -R mysql.mysql /data/mysql/
6)拷贝必要的文件(此为可选步骤):
[[email protected] local]#cp support-files/mysql.server /etc/init.d/mysql.server
7)启动数据库:
[[email protected] 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’;
原创文章,作者:Maggie-Hunter,如若转载,请注明出处:https://blog.ytso.com/3834.html