mysql5.7.17 64位rhel6.5下安装
发表于:2025-11-15 作者:千家信息网编辑
千家信息网最后更新 2025年11月15日,安装环境:rhel6.5_64MySQL Community Server 5.7.17 64位下载yum安装源文件:http://dev.mysql.com/get/mysql57-communit
千家信息网最后更新 2025年11月15日mysql5.7.17 64位rhel6.5下安装安装环境:
rhel6.5_64
MySQL Community Server 5.7.17 64位
下载yum安装源文件:
http://dev.mysql.com/get/mysql57-community-release-el6-9.noarch.rpm
安装下载的mysql57-community-release-el6-9.noarch.rpm
[root@rhel-mysql ~]# rpm -Uvh mysql57-community-release-el6-9.noarch.rpm
Preparing... ########################################### [100%]
package mysql57-community-release-el6-9.noarch is already installed
运行yum安装mysql
[root@rhel-mysql ~]# yum install mysql-server
安装完毕后,启动mysql
[root@rhel-mysql ~]# service mysqld start
Initializing MySQL database: [ OK ] --第一次start会出现
Installing validate password plugin: [ OK ] --第一次start会出现
Starting mysqld: [ OK ]
得到初始化root密码
[root@rhel-mysql ~]# grep "password" /var/log/mysqld.log
2016-12-13T15:52:48.468591Z 1 [Note] A temporary password is generated for root@localhost: Tyi>x2016-12-13T15:52:53.978420Z 0 [Note] Execution of init_file '/var/lib/mysql/install-validate-password-plugin.8rIs89.sql' started.
2016-12-13T15:52:53.990711Z 0 [Note] Execution of init_file '/var/lib/mysql/install-validate-password-plugin.8rIs89.sql' ended.
2016-12-13T15:52:55.871356Z 0 [Note] Shutting down plugin 'sha256_password'
2016-12-13T15:52:55.871365Z 0 [Note] Shutting down plugin 'mysql_native_password'
2016-12-13T15:52:57.329377Z 3 [Note] Access denied for user 'UNKNOWN_MYSQL_USER'@'localhost' (using password: NO)
在my.cnf中加入validate_password_policy=0
[root@rhel-mysql ~]# vi /etc/my.cnf
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
symbolic-links=0
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
validate_password_policy=0
重启mysql使my.cnf生效
[root@rhel-mysql ~]# service mysqld restart
Stopping mysqld: [ OK ]
Starting mysqld: [ OK ]
运行 mysql_secure_installation,修改root密码,然后全部默认回车
[root@rhel-mysql ~]# mysql_secure_installation
Securing the MySQL server deployment.
Enter password for user root:
The 'validate_password' plugin is installed on the server.
The subsequent steps will run with the existing configuration
of the plugin.
Using existing password for root.
Estimated strength of the password: 50
Change the password for root ? ((Press y|Y for Yes, any other key for No) :
... skipping.
By default, a MySQL installation has an anonymous user,
allowing anyone to log into MySQL without having to have
a user account created for them. This is intended only for
testing, and to make the installation go a bit smoother.
You should remove them before moving into a production
environment.
Remove anonymous users? (Press y|Y for Yes, any other key for No) :
... skipping.
Normally, root should only be allowed to connect from
'localhost'. This ensures that someone cannot guess at
the root password from the network.
Disallow root login remotely? (Press y|Y for Yes, any other key for No) :
Success.
By default, MySQL comes with a database named 'test' that
anyone can access. This is also intended only for testing,
and should be removed before moving into a production
environment.
Remove test database and access to it? (Press y|Y for Yes, any other key for No) :
... skipping.
Reloading the privilege tables will ensure that all changes
made so far will take effect immediately.
Reload privilege tables now? (Press y|Y for Yes, any other key for No) :
Success.
All done!
用新root密码登录数据库
[root@rhel-mysql ~]# mysql -uroot -p11111111
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 11
Server version: 5.7.17 MySQL Community Server (GPL)
Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| sys |
+--------------------+
4 rows in set (0.00 sec)
root用户拥有远程登陆的权限
mysql> grant all privileges on *.* to 'root'@'%' identified by '11111111' with grant option;
Query OK, 0 rows affected, 1 warning (0.00 sec)
创建数据库 create datasase zhangsan;
mysql> create database zhangsan;
Query OK, 1 row affected (0.00 sec)
创建用户
mysql> CREATE USER 'hug'@'%' IDENTIFIED BY '12345678';
Query OK, 0 rows affected (0.01 sec)
为新用户是授权
mysql> grant all privileges on zhangsan.* to hug;
Query OK, 0 rows affected (0.00 sec)
至此,mysql 5.7.17 设置完毕
设置mysql自动启动,默认安装完毕后在3、4、5下是默认启动的
[root@rhel-mysql ~]# chkconfig --list mysqld
mysqld 0:off 1:off 2:off 3:on 4:on 5:on 6:off
修改mysqld是否自启动
[root@rhel-mysql ~]# chkconfig --level 345 mysqld off
[root@rhel-mysql ~]# chkconfig --list mysqld
mysqld 0:off 1:off 2:off 3:off 4:off 5:off 6:off
[root@rhel-mysql ~]# chkconfig --level 345 mysqld on
[root@rhel-mysql ~]# chkconfig --list mysqld
mysqld 0:off 1:off 2:off 3:on 4:on 5:on 6:off
rhel6.5_64
MySQL Community Server 5.7.17 64位
下载yum安装源文件:
http://dev.mysql.com/get/mysql57-community-release-el6-9.noarch.rpm
安装下载的mysql57-community-release-el6-9.noarch.rpm
[root@rhel-mysql ~]# rpm -Uvh mysql57-community-release-el6-9.noarch.rpm
Preparing... ########################################### [100%]
package mysql57-community-release-el6-9.noarch is already installed
运行yum安装mysql
[root@rhel-mysql ~]# yum install mysql-server
安装完毕后,启动mysql
[root@rhel-mysql ~]# service mysqld start
Initializing MySQL database: [ OK ] --第一次start会出现
Installing validate password plugin: [ OK ] --第一次start会出现
Starting mysqld: [ OK ]
得到初始化root密码
[root@rhel-mysql ~]# grep "password" /var/log/mysqld.log
2016-12-13T15:52:48.468591Z 1 [Note] A temporary password is generated for root@localhost: Tyi>x
2016-12-13T15:52:53.990711Z 0 [Note] Execution of init_file '/var/lib/mysql/install-validate-password-plugin.8rIs89.sql' ended.
2016-12-13T15:52:55.871356Z 0 [Note] Shutting down plugin 'sha256_password'
2016-12-13T15:52:55.871365Z 0 [Note] Shutting down plugin 'mysql_native_password'
2016-12-13T15:52:57.329377Z 3 [Note] Access denied for user 'UNKNOWN_MYSQL_USER'@'localhost' (using password: NO)
在my.cnf中加入validate_password_policy=0
[root@rhel-mysql ~]# vi /etc/my.cnf
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
symbolic-links=0
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
validate_password_policy=0
重启mysql使my.cnf生效
[root@rhel-mysql ~]# service mysqld restart
Stopping mysqld: [ OK ]
Starting mysqld: [ OK ]
运行 mysql_secure_installation,修改root密码,然后全部默认回车
[root@rhel-mysql ~]# mysql_secure_installation
Securing the MySQL server deployment.
Enter password for user root:
The 'validate_password' plugin is installed on the server.
The subsequent steps will run with the existing configuration
of the plugin.
Using existing password for root.
Estimated strength of the password: 50
Change the password for root ? ((Press y|Y for Yes, any other key for No) :
... skipping.
By default, a MySQL installation has an anonymous user,
allowing anyone to log into MySQL without having to have
a user account created for them. This is intended only for
testing, and to make the installation go a bit smoother.
You should remove them before moving into a production
environment.
Remove anonymous users? (Press y|Y for Yes, any other key for No) :
... skipping.
Normally, root should only be allowed to connect from
'localhost'. This ensures that someone cannot guess at
the root password from the network.
Disallow root login remotely? (Press y|Y for Yes, any other key for No) :
Success.
By default, MySQL comes with a database named 'test' that
anyone can access. This is also intended only for testing,
and should be removed before moving into a production
environment.
Remove test database and access to it? (Press y|Y for Yes, any other key for No) :
... skipping.
Reloading the privilege tables will ensure that all changes
made so far will take effect immediately.
Reload privilege tables now? (Press y|Y for Yes, any other key for No) :
Success.
All done!
用新root密码登录数据库
[root@rhel-mysql ~]# mysql -uroot -p11111111
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 11
Server version: 5.7.17 MySQL Community Server (GPL)
Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| sys |
+--------------------+
4 rows in set (0.00 sec)
root用户拥有远程登陆的权限
mysql> grant all privileges on *.* to 'root'@'%' identified by '11111111' with grant option;
Query OK, 0 rows affected, 1 warning (0.00 sec)
创建数据库 create datasase zhangsan;
mysql> create database zhangsan;
Query OK, 1 row affected (0.00 sec)
创建用户
mysql> CREATE USER 'hug'@'%' IDENTIFIED BY '12345678';
Query OK, 0 rows affected (0.01 sec)
为新用户是授权
mysql> grant all privileges on zhangsan.* to hug;
Query OK, 0 rows affected (0.00 sec)
至此,mysql 5.7.17 设置完毕
设置mysql自动启动,默认安装完毕后在3、4、5下是默认启动的
[root@rhel-mysql ~]# chkconfig --list mysqld
mysqld 0:off 1:off 2:off 3:on 4:on 5:on 6:off
修改mysqld是否自启动
[root@rhel-mysql ~]# chkconfig --level 345 mysqld off
[root@rhel-mysql ~]# chkconfig --list mysqld
mysqld 0:off 1:off 2:off 3:off 4:off 5:off 6:off
[root@rhel-mysql ~]# chkconfig --level 345 mysqld on
[root@rhel-mysql ~]# chkconfig --list mysqld
mysqld 0:off 1:off 2:off 3:on 4:on 5:on 6:off
密码
用户
数据
数据库
第一次
运行
权限
源文件
环境
至此
中加
登录
登陆
数据库的安全要保护哪些东西
数据库安全各自的含义是什么
生产安全数据库录入
数据库的安全性及管理
数据库安全策略包含哪些
海淀数据库安全审计系统
建立农村房屋安全信息数据库
易用的数据库客户端支持安全管理
连接数据库失败ssl安全错误
数据库的锁怎样保障安全
巴士管家软件开发
软件开发工程师业绩指标
加强网络安全的实施意见
为什么要对数据库保护
杭州软件开发平台哪个好
齐向东宣布北京网络安全大会
二手服务器研究报告
江苏惠普服务器续保哪家便宜
株洲正规软件开发哪家专业
网络安全推文例子
DENMARK字体软件开发
关系数据库中什么是一个虚表
剑与家园用什么软件开发的
软件开发的竞标优势怎么写
报表数据库设计
热水器是水伺服务器和水气
导弹软件开发
浙江嘉兴红盟软件开发
数据库设计灵活性原则
联得系统网络安全管理制度
ssh查看服务器是否启动
手机网络安全类型不正确怎么解决
文件在服务器上的大文件分块上传
梦三国连接不上服务器
南宁国海网络技术公司
数据通信和网络技术的区别
软件开发工作计划及论证方案
网络安全奥义是人工智能吗
光学设计和软件开发
电视台信息网络安全制度