nginx 二进制包安装mysql_二进制安装mysql5.7

下载地址:https://downloads.mysql.com/archives/community/

7c43f94e1920bd1003d7ed1047f40a44.png

[root@localhost soft]# ls

mysql-5.7.17-linux-glibc2.5-x86_64.tar.gz nginx-1.12.2 nginx-1.12.2.tar.gz

[root@localhost soft]#

1.详细描安装的过程

1.1关闭防火墙

systemctl stop firewalld.service #停止firewall

systemctl disable firewalld.service #禁止firewall开机启动

firewall-cmd --state #查看默认防火墙状态(关闭后显示notrunning,开启后显示running)

检查是否安装NySQL,如果安装 卸载之

rpm -qa |grep mysql

yum remove mysql*

检查是否安装MariaDB,如果安装 卸载之(重要)

rpm -qa |grep mariadb

yum remove mariadb*

新增用户/组 参数文件

groupadd mysql

useradd mysql -g mysql -M -s /sbin/nologin

创建目录并授权

mkdir -p /data/3306

mkdir log

chown -R mysql.mysql /data

配置文件和启动文件修改:

mv ./my.cnf /etc/

cp /application/mysql/support-files/mysql.server  /etc/init.d/mysqld

vim /etc/init.d/mysqld

修改:

basedir=/application/mysql

datadir=/data/3306/data

初始化:

./bin/mysqld  --initialize --user=mysql --basedir=/application/mysql --datadir=/data/3306/data

[root@localhost 3306]# ll

总用量 4

drwxr-x--- 5 mysql mysql 147 8月 5 23:30 data

drwxr-xr-x 2 mysql mysql 34 8月 5 23:30 log

-rw-r----- 1 mysql mysql 802 8月 5 23:30 mysql_error.log

[root@localhost data]# ll

总用量 143396

-rw-r----- 1 mysql mysql 56 8月 5 23:30 auto.cnf

-rw-r----- 1 mysql mysql 413 8月 5 23:30 ib_buffer_pool

-rw-r----- 1 mysql mysql 12582912 8月 5 23:30 ibdata1

-rw-r----- 1 mysql mysql 67108864 8月 5 23:30 ib_logfile0

-rw-r----- 1 mysql mysql 67108864 8月 5 23:30 ib_logfile1

drwxr-x--- 2 mysql mysql 4096 8月 5 23:30 mysql

drwxr-x--- 2 mysql mysql 8192 8月 5 23:30 performance_schema

drwxr-x--- 2 mysql mysql 8192 8月 5 23:30 sys

[root@localhost 3306]# grep 'temporary password' ./mysql_error.log2018-08-05T15:30:45.859098Z 1 [Note] A temporary password is generated for root@localhost: r6IiVQkl_mfm

r6IiVQkl_mfm为mysql的root用户登录的随机密码

启动mysql

[root@localhost 3306]# service mysqld start

Starting MySQL.2018-08-05T15:35:41.111817Z mysqld_safe The file /usr/local/mysql/bin/mysqld

does not exist or is not executable. Please cd to the mysql installation

directory and restart this script from there as follows:

./bin/mysqld_safe&

See http://dev.mysql.com/doc/mysql/en/mysqld-safe.html for more information

ERROR! The server quit without updating PID file (/data/3306/data/localhost.localdomain.pid).

[root@localhost 3306]#

会发现报错了。。。。。。。。不要慌

错误:/usr/local/mysql/bin/mysqld does not exist

解决:

[root@localhost 3306]# mkdir -p /usr/local/mysql/bin

[root@localhost 3306]# ln -s /application/mysql/bin/mysqld /usr/local/mysql/bin

大功告成了:

[root@localhost 3306]# service mysqld start

Starting MySQL.. SUCCESS!

把mysql命令加到环境变量中

vim /etc/profile

最底下修改:

PATH="/application/mysql/bin/:$PATH"tail-1 /etc/profile

source/etc/profile

[root@localhost 3306]# ps -ef|grep mysqld

root3822 1 0 23:38 pts/2 00:00:00 /bin/sh /application/mysql/bin/mysqld_safe --datadir=/data/3306/data --pid-file=/data/3306/data/localhost.localdomain.pid

mysql4275 3822 0 23:38 pts/2 00:00:00 /usr/local/mysql/bin/mysqld --basedir=/application/mysql --datadir=/data/3306/data --plugin-dir=/application/mysql/lib/plugin --user=mysql --log-error=/data/3306/mysql_error.log --open-files-limit=65535 --pid-file=/data/3306/data/localhost.localdomain.pid --socket=/data/3306/mysql.sock --port=3306root4378 2807 0 23:42 pts/2 00:00:00 grep --color=auto mysqld

登录mysql: 密码为上面随机密码

mysql -uroot -pr6IiVQkl_mfm

登录成功之后再修改密码:

mysql> set PASSWORD=PASSWORD('123456');

Query OK, 0 rows affected, 1 warning (0.00 sec)

flush privileges;

mysql>show databases;+--------------------+

| Database |

+--------------------+

| information_schema |

| mysql |

| performance_schema |

| sys |

+--------------------+

4 rows in set (0.00 sec)

mysql远程链接:

mysql>use mysql;

Database changed

mysql> update user set host ='%'where user ='root' and host ='localhost';

Query OK,1 row affected (0.00sec)

Rows matched:1 Changed: 1 Warnings: 0mysql>flush privileges;

Query OK,0 rows affected (0.00sec)

mysql> select host,user fromuser;+-----------+-----------+

| host | user |

+-----------+-----------+

| % | root |

| localhost | mysql.sys |

+-----------+-----------+

2 rows in set (0.00sec)

mysql>

2bdd77e07568767e224acba06e4fdd54.png

[root@localhost 3306]# ll

总用量20drwxr-x--- 6 mysql mysql 229 8月 5 23:51data

drwxr-xr-x 2 mysql mysql 34 8月 5 23:30log-rw-r----- 1 mysql mysql 12690 8月 5 23:51mysql_error.log

srwxrwxrwx1 mysql mysql 0 8月 5 23:51mysql.sock-rw------- 1 mysql mysql 5 8月 5 23:51 mysql.sock.lock

[root@localhost data]# ll

总用量155692

-rw-r----- 1 mysql mysql 56 8月 5 23:30auto.cnf-rw-r----- 1 mysql mysql 384 8月 5 23:50ib_buffer_pool-rw-r----- 1 mysql mysql 12582912 8月 5 23:51ibdata1-rw-r----- 1 mysql mysql 67108864 8月 5 23:51ib_logfile0-rw-r----- 1 mysql mysql 67108864 8月 5 23:30ib_logfile1-rw-r----- 1 mysql mysql 12582912 8月 5 23:51ibtmp1-rw-r----- 1 mysql mysql 5 8月 5 23:51localhost.localdomain.pid

drwxr-x--- 2 mysql mysql 4096 8月 5 23:30mysql-rw-rw---- 1 root root 5 8月 5 23:51mysqld_safe.pid

drwxr-x--- 2 mysql mysql 8192 8月 5 23:30performance_schema

drwxr-x--- 2 mysql mysql 8192 8月 5 23:30sys

drwxr-x--- 2 mysql mysql 52 8月 5 23:49 test

完结。。。。。。。。。。。。。。。。。就这么简单

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值