CentOS 6.5 二进制安装MysqL 5.6
--------------------------------
下载MysqL5.6二进制包
MysqL-5.6.20-linux-glibc2.5-x86_64.tar.gz
安装相关依赖包
yum install libaio*
useradd MysqL
tar zxvf MysqL-5.6.20-linux-glibc2.5-x86_64.tar.gz -C /data/
mv MysqL-5.6.20-linux-glibc2.5-x86_64 MysqL
修改MysqL的各级文件夹和文件的创建者、创建组为MysqL(注意语句后面有个.)
chown -R MysqL.MysqL /data/MysqL
至此MysqL已经安装完了,
但还需要初始化,初始化MysqL表、test表、infomation表等。
/data/MysqL/scripts/MysqL_install_db --datadir=/data/MysqL/data --basedir=/data/MysqL --user=MysqL --explicit_defaults_for_timestamp
-------------------------------------------------------------------------------------------------------------------------------------
拷贝启动脚本
cp /data/MysqL/support-files/MysqL.server /etc/init.d/MysqLd
ln -s /data/MysqL/include /usr/include/MysqL
echo "/data/MysqL/lib" > /etc/ld.so.conf.d/MysqL.conf && ldconfig -v
ln -s /data/MysqL/bin/MysqL /usr/bin
cd /data/MysqL
cp my.cnf /etc/my.cnf
vim /etc/my.cnf
basedir = /data/MysqL
datadir = /data/MysqL/data
port = 3306
server_id = 1
-------------------------
启动MysqL服务
chkconfig MysqLd on
service MysqLd start
MysqL> SELECT user,host,password FROM MysqL.user;
+------+-----------------------+----------+
| user | host | password |
+------+-----------------------+----------+
| root | localhost | |
| root | localhost.localdomain | |
| root | 127.0.0.1 | |
| root | ::1 | |
| | localhost | |
| | localhost.localdomain | |
+------+-----------------------+----------+
6 rows in set (0.00 sec)
设置密码()括号里面的为密码,用户名root
MysqL> UPDATE MysqL.user set password = PASSWORD('Zykj@password') WHERE user = 'root';
MysqL> SELECT user,password FROM MysqL.user;
+------+-----------------------+-------------------------------------------+
| user | host | password |
+------+-----------------------+-------------------------------------------+
| root | localhost | *11B9ACA21786F766739D0EB1483C5F64212B81AC |
| root | localhost.localdomain | *11B9ACA21786F766739D0EB1483C5F64212B81AC |
| root | 127.0.0.1 | *11B9ACA21786F766739D0EB1483C5F64212B81AC |
| root | ::1 | *11B9ACA21786F766739D0EB1483C5F64212B81AC |
| | localhost | |
| | localhost.localdomain | |
+------+-----------------------+-------------------------------------------+
6 rows in set (0.00 sec)
MysqL> DROP USER ''@localhost;
MysqL> FLUSH PRIVILEGES;
MysqL> quit
---------------------MysqL安装完成-------------------------------
设置/修改 密码
MysqL> grant all privileges on *.* to 'root'@'localhost' identified by 'Zykj@password' with grant option;
MysqL> flush privileges;