1、Mysql安装
准备工作
首先是单实例安装,也就是一台服务器上就装一个mysql,多实例安装就是在一个服务器上安装2个甚至多个mysql。
linux配置信息如下:
单实例安装
1、新建soft文件夹,将mysql安装文件上传到该路径下,并复制到/usr/local 路径下
cp /soft/mysql-5.7.9-linux-glibc2.5-x86_64.tar.gz /usr/local/
2、解压 mysql 到/usr/local 目录
tar -zxvf mysql-5.7.9-linux-glibc2.5-x86_64.tar.gz
3、INSTALL-BINARY:官方安装推荐文档。
安装需要的依赖
yum install -y libaio
具体安装
shell> groupadd mysql
shell> useradd -r -g mysql mysql
shell> cd /usr/local
shell> tar -zxvf mysql-5.7.9-linux-glibc2.5-x86_64.tar.gz
shell> ln -s /usr/local/mysql-5.7.9-linux-glibc2.5-x86_64 mysql
shell> cd mysql
shell> mkdir mysql-files
shell> chmod 770 mysql-files
shell> chown -R mysql .
shell> chgrp -R mysql .
shell> bin/mysqld --initialize --user=mysql # MySQL 5.7.6 and up
ycekpvlH>43e
shell> bin/mysql_ssl_rsa_setup # MySQL 5.7.6 and up
shell> chown -R root .
shell> mkdir data
shell> chown -R mysql data mysql-files
/usr/local/mysql/bin/mysqld --verbose --help|grep -A 1 ‘Default options’
shell> bin/mysqld_safe --user=mysql & # Next command is optional
Mysql已经启动成功
shell> cp support-files/mysql.server /etc/init.d/mysql.server
配置环境变量:
Vi /etc/profile
export PATH=/usr/local/mysql/bin:$PATH
source /etc/profile
配置开启启动
chkconfig mysql.server on
chkconfig --list
登陆,修改密码
mysql -uroot -p ‘ycekpvlH>43e’
set password = ‘root1234%’;
允许远程登陆
GRANT ALL PRIVILEGES ON . TO ‘root’@’%’ IDENTIFIED BY ‘root1234%’ WITH GRANT OPTION;
flush privileges;