二进制安装mysql
Posted jialinux
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了二进制安装mysql相关的知识,希望对你有一定的参考价值。
- 首先。要有软件包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
- [[email protected] ~]#yum -y install libaio
- [[email protected] ~]#tar zxf mysql-5.7.24-linux-glibc2.12-x86_64.tar.gz -C /usr/local
- [[email protected] ~]# cd /usr/local/
- [[email protected] local]# mv mysql-5.7.24-linux-glibc2.12-x86_64/ mysql
- [[email protected] local]# useradd -M -s /sbin/nologin mysql
- [[email protected] local]# cd mysql/
- [[email protected] mysql]# chown -R mysql:mysql ./
- [[email protected] mysql]# ./bin/mysqld --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --initialize
- [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的主要内容,如果未能解决你的问题,请参考以下文章