MySQL mysql-5.7.24-1.el7.x86_64.rpm-bundle.tar 下载镜像: http://mirrors.163.com/mysql/Downloads/MySQL-5.7/mysql-5.7.24-1.el7.x 86_64.rpm-bundle.tar
Mycat 下载地址: http://dl.mycat.io 当前最新版本:1.6.6.1
2 JDK安装
上传jdk安装包到linux机器上
root用户身份安装,命令:
jdk被安装在 /usr/java目录下
配置JAVA环境变量,命令: 在文件末尾追加: 保存退出 使配置生效,命令: rpm -ivh jdk-8u162-linux-x64.rpm vi /etc/profile export JAVA_HOME=/usr/java/latest export CLASSPATH=.:
J
A
V
A
H
O
M
E
/
l
i
b
e
x
p
o
r
t
P
A
T
H
=
JAVA_HOME/lib export PATH=
JAVAHOME/libexportPATH=JAVA_HOME/bin:$PATH
验证
3 MySQL安装
上传MySQL安装包;
在上传目录创建目录 mysql
解压安装包
安装: source /etc/profile java -version mkdir mysql tar -xvf mysql-5.7.24-1.el7.x86_64.rpm-bundle.tar -C mysql Files or Resources Location Client programs and scripts /usr/bin mysqld server /usr/sbin Configuration file /etc/my.cnf Data directory /var/lib/mysql Error log file For RHEL, Oracle Linux, CentOS or Fedora platforms: /var/log/mysqld.log For SLES: /var/log/mysql/mysqld.log Value of secure_file_priv /var/lib/mysql-files System V init script For RHEL, Oracle Linux, CentOS or Fedora platforms: /etc/init.d/mysqld For SLES: /etc/init.d/mysql Systemd service For RHEL, Oracle Linux, CentOS or Fedora platforms: mysqld For SLES: mysql Pid file /var/run/mysql/mysqld.pid Socket /var/lib/mysql/mysql.sock Keyring directory /var/lib/mysql-keyring Unix manual pages /usr/share/man Include (header) files /usr/include/mysql Libraries /usr/lib/mysql Miscellaneous support files (for example, error messages, and character set files) /usr/share/mysql
安装完成,安装过程中会创建用户 mysql ,所属组 mysql。mysql内容的目录分布情况:
注意:Linux 下部署安装MySQL,默认不忽略表名大小写,需要手动到/etc/my.cnf 下配置 lower_case_table_names=1 使Linux 环境下MySQL 忽略表名大小写,否则使用MyCAT 的 时候会提示找不到 表的错误! cd mysql rm -f mysql-community-server-minimal-5.7.24-1.el7.x86_64.rpm yum install mysql-community-{server,client,common,libs}-* mysql-5.* vi /etc/my.cnf
启动mysql服务,命令: systemctl start mysqld 第一次启动过程将完成如下事项: 服务器被初始化。 在数据目录中生成SSL证书和密钥文件。 validate_password已安装并启用。 超级用户帐户’root’@'localhost’被创建。超级用户的密码被设置并存储在错误日志文 件中。要提取它,请对RHEL、Oracle Linux、CentOS和Fedora系统使用以下命令: grep ‘temporary password’ /var/log/mysqld.log 8. 修改root用户密码,用上面提取到的密码登录: mysql -uroot -p mysql> ALTER USER ‘root’@‘localhost’ IDENTIFIED BY ‘MyNewPass4!’;
创建使用用户 mysql> grant all privileges on *. * to ‘mike’@’%’ identified by ‘Mike666!’; <点后面多了个空格> mysql> flush privileges;