--------------------------------------------------软件包下载链接------------------------------------------------------------------------
http://pan.baidu.com/s/1jI45sX4 密码:fvry
--------------------------------------------------MYSQL二进制安装--------------------------------------------------------------------
#tar -xf mysql-5.7.17-linux-glibc2.5-x86_64.tar.gz -C /usr/local/ 指定解压到/usr/lcoal,文件INSTALL-BINARY中有安装步骤
#less INSTALL-BINARY
#ln -sv mysql-5.7.17-linux-glibc2.5-x86_64.tar.gz mysql 创建软连接
#groupadd -r -g 306 mysql 创建系统组mysql
#useradd -r -g 306 -u 306 msyql 创建系统用户mysql
#chown -R mysql.mysql /usr/local/mysql/* 更改mysql文件下文件的所属主和组R递归
----------------------------------------------------------------------------------------------------------------------------------------------
-----------------------------------------------------创建单独的datadir-----------------------------------------------------------------
建立分区,类型8e(lvm)
#partprobe /dev/sdb 同步磁盘
#pvcreate /dev/sdb1 建立pv物理卷
#pvs 查看物理卷
#vgcreate myvg /dev/sdb1 建立逻辑组
#lvcreate -n mydata -L 3G myvg 建立逻辑盘区
#mkfs -t ext4 /dev/myvg/mydata 格式化
#vim /etc/fstable 编辑挂载文件
/dev/myvg/mydata /mydata ext4 defaltes 0 0
#mkdir /mydata 创建目录
#mount -a 读取挂载
#mkdir /mydata/mysql
#chown -R mysql.mysql /mydata/mysql
-------------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------5.7.6之前初始化--------------------------------------------------------------------------
#bin/mysql_install_db (5.7.6后使用的是bin/mysqld)
--help 可以查看mysql_isntall_db的选项
--datadir=path 指定数据库的路径
-u=user_name(--user=user_name) 以哪个用户
---------------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------5.7.6之后初始化---------------------------------------------------------------------
#bin/mysqld --initialize --user=mysql (initialize-insecure无密码形式,会显示密码过期)
--datadir=/mydata/mysql 指定数据库)A temporary password is generated for root@localhost: I?fct+Vjq36k最后一行为root密码
#chown -R root /usr/local/mysql/*
--------------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------开机启动设置-------------------------------------------------------------------------
#cp support-files/mysql.server /etc/init.d/mysqld 复制mysql的起动脚本到init.d下
#chkconfig --add mysqld 加入开机起动列表
#chkconfig --list 查看列表
---------------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------mysql配制文件------------------------------------------------------------------------
#cp support-files/mysql-default.cnf /etc/my.cnf
#vim /etc/my.cnf
mysql: /etc/my.cnf
basedir =/usr/local/mysql
datadir =/mydata/mysql
port =3306
server_id =1
socket =/tmp/mysql.sock
character_set_server =utf8
#log-error=/var/log/mysql/mysql_error.log
#pid-file=/mydata/mysql/mysql.pid
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
[client]
socket =/tmp/mysql.sock
------------------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------设置帮助文件----------------------------------------------------------------------------
# vim /etc/man_db.conf (旧版本)#vim /etc/man.config
MANDATORY_MANPATH /usr/local/mysql/man MANPATH //usr/local/mysql/man 设置mysql帮助配制的
------------------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------设置库文件-------------------------------------------------------------------------------
#vim /etc/ld.so.conf.d/mysql.conf
/usr/local/mysql/lib 编辑加内容一行
#ldconfig -v 让系统重新读取库文
--------------------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------设置头文件---------------------------------------------------------------------------------
#ln -sv /usr/local/mysql/include /usr/include/mysql
--------------------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------启动mysql----------------------------------------------------------------------------------
#service msyqld restart 启动
# mysql -uroot -p"gZ&+,mlzw4VP" 登陆
>set password for 'root'@'localhost'=password('newpasswd') 设置密码
#vim /etc/profile.d/mysql.sh 添加PATH
export PAHT=$PATH:/usr/local/mysql/bin
--------------------------------------------------------------------------------------------------------------------------------------------------