二进制安装mysql

Posted jialinux

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了二进制安装mysql相关的知识,希望对你有一定的参考价值。

  1. 首先。要有软件包mysql-5.7.24-linux-glibc2.12-x86_64.tar.gz

wget http://mirrors.sohu.com/mysql/MySQL-5.7/mysql-5.7.24-linux-glibc2.12-x86_64.tar.gz

  1. [[email protected] ~]#yum -y install libaio
  2. [[email protected] ~]#tar zxf mysql-5.7.24-linux-glibc2.12-x86_64.tar.gz -C /usr/local
  3. [[email protected] ~]# cd /usr/local/
  4. [[email protected] local]# mv mysql-5.7.24-linux-glibc2.12-x86_64/ mysql
  5. [[email protected] local]# useradd -M -s /sbin/nologin mysql
  6. [[email protected] local]# cd mysql/
  7. [[email protected] mysql]# chown -R mysql:mysql ./
  8. [[email protected] mysql]# ./bin/mysqld --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --initialize
  9. [Note] A temporary password is generated for [email protected]: ho19hx,%sZNq

记住上面这一行的密码。这个是初始密码。每一台机器的初始密码都不一样。

  10. 修改/etc/my.cnf文件。(因为我们的mysql安装在/usr/local/下的,所以需要重新定义)

[mysqld]

datadir=/usr/local/mysql/data

socket=/tmp/mysql.sock

# Disabling symbolic-links is recommended to prevent assorted security risks

symbolic-links=0

# Settings user and group are ignored when systemd is used.

# If you need to run mysqld under a different user or group,

# customize your systemd unit file for mariadb according to the

# instructions in http://fedoraproject.org/wiki/Systemd

 

[mysqld_safe]

log-error=/usr/local/mysql/data/mysql.log

pid-file=/usr/local/mysql/data/mysql.pid

到这一步其实就已经做完了,后面的都是起服务跟优化

  11. [[email protected] mysql]# ./support-files/mysql.server start

  12 . [[email protected] mysql]# netstat -anpt |grep 3306

  13. [[email protected] mysql]# cp support-files/mysql.server /etc/init.d/mysqld

  14. [[email protected] mysql]# service mysqld restart

  15. [[email protected] mysql]# ./bin/mysqladmin -u root -p password ‘123123‘

  16. [[email protected] mysql]# ln -s /usr/local/mysql/bin/* /usr/local/bin

  17. [[email protected] mysql]#service mysql restart

以上是关于二进制安装mysql的主要内容,如果未能解决你的问题,请参考以下文章

centos7 二进制安装包安装 mysql5.6

二进制包安装MYSQL

MySQL安装(yum二进制源码)

MySQL 安装(二进制版)

mysql-5.5.56版本(二进制包安装)-自定义安装路径

mysql-5.7.18版本(二进制包安装)-自定义安装路径