首页 > 代码库 > mysql5.6安装
mysql5.6安装
一 yum安装mysql
配置好yum源
yum install –y mysql-server mysql-develmysql
Mysql-devel库文件
Mysql-server主程序包
Mysql-链接的客户端
安装即可
二 普通用户源码安装mysql
groupaddmysql
useraddmysql -g mysql -d /mysql
tar -zxfmysql-5.6.19-linux-glibc2.5-x86_64.tar.gz
mvmysql-5.6.19-linux-glibc2.5-x86_64 mysql5.6.19
rm -rfmysql-5.6.19-linux-glibc2.5-x86_64.tar.gz
mkdir{data3306,backup,scripts} //创建所需文件夹
cdmysql5.6.19
rz //上传my.cnf
./scripts/mysql_install_db--defaults-file=/mysql/mysql5.6.19/my.cnf --basedir=/mysql/mysql5.6.19--datadir=/mysql/data3306 --user=mysql //安装mysql
cd/mysql/scripts
cat<< EOF > mysqlstart.sh //编写start脚本
#!/bin/bash
cd/mysql/mysql5.6.19
./bin/mysqld_safe--defaults-file=/mysql/mysql5.6.19/my.cnf --basedir=/mysql/mysql5.6.19--datadir=/mysql/data3306 --user=mysql &
EOF
cat<< EOF > mysqlstop.sh //编写stop脚本
#!/bin/bash
/mysql/mysql5.6.19/bin/mysqladmin-uroot -pking123 -S /mysql/mysql.sock shutdown
EOF
chmod755 mysqlstart.sh
chmod755 mysqlstop.sh
chmod755 backup.sh
cd
./scripts/mysqlstart.sh
ln -s/mysql/mysql.sock /tmp/
echo‘export PATH="$PATH:/mysql/mysql5.6.19/bin"‘ > .bash_profile //配置环境变量
source.bash_profile
mysql_secure_installation //安装配置向导
crontab –e
00 03 ** * /mysql/scripts/backup.sh //定时备份
进入到mysql中:
selectuser,host,password from user; //查询
grantall on *.* to mocha@‘10.%‘ identified by ‘mocha123!‘; //授权mocha用户有监控权限
GRANTall ON *.* TO repl@‘10.%‘ IDENTIFIED BY ‘repl123!‘; //授权repl用户权限
CHANGEMASTER TOMASTER_HOST=‘10.10.103.11‘,MASTER_USER=‘repl‘,MASTER_PORT=3306,MASTER_PASSWORD=‘repl123!‘,MASTER_LOG_FILE=‘mysql_bin.000003‘,MASTER_LOG_POS=2699; //slave主从配置
mstsc/console
问题解决方法:
stopslave;
setglobal sql_slave_skip_counter=1;
startslave;
本文出自 “卓尔的博客” 博客,请务必保留此出处http://6874869.blog.51cto.com/6864869/1862333
mysql5.6安装