Mysql应用阿里云 Centos7.3安装mysql5.7.18 rpm安装教程
《Mysql应用阿里云 Centos7.3安装mysql5.7.18 rpm安装教程》要点: MYSQL学习卸载MariaDB MYSQL学习CentOS7默认安装MariaDB而不是MySQL,而且yum服务器上也移除了MySQL相关的软件包.因为MariaDB和MySQL可能会冲突,故先卸载MariaDB. MYSQL学习1、安装新版mysql之前,我们需要将系统自带的mariadb-lib卸载 MYSQL学习[root@iZwz94qazh62gk5ewl4ei2Z home]# rpm -qa | grep -i mariadb MYSQL学习2、到mysql的官网下载最新版mysql的rpm集合包:mysql-5.7.18-1.el6.x86_64.rpm-bundle.tar MYSQL学习3、上传mysql-5.7.18-1.el6.x86_64.rpm-bundle.tar到linux服务器,并解压tar包 MYSQL学习
[root@iZwz94qazh62gk5ewl4ei2Z home]# mkdir mysql
[root@iZwz94qazh62gk5ewl4ei2Z home]# tar -xf mysql-5.7.18-1.el6.x86_64.rpm-bundle.tar -C mysql
[root@iZwz94qazh62gk5ewl4ei2Z home]# cd mysql
[root@iZwz94qazh62gk5ewl4ei2Z mysql]# ll
total 459492
-rw-r--r-- 1 7155 31415 23618836 Mar 20 17:40 mysql-community-client-5.7.18-1.el6.x86_64.rpm
-rw-r--r-- 1 7155 31415 335496 Mar 20 17:40 mysql-community-common-5.7.18-1.el6.x86_64.rpm
-rw-r--r-- 1 7155 31415 3747352 Mar 20 17:40 mysql-community-devel-5.7.18-1.el6.x86_64.rpm
-rw-r--r-- 1 7155 31415 39086508 Mar 20 17:40 mysql-community-embedded-5.7.18-1.el6.x86_64.rpm
-rw-r--r-- 1 7155 31415 135869292 Mar 20 17:40 mysql-community-embedded-devel-5.7.18-1.el6.x86_64.rpm
-rw-r--r-- 1 7155 31415 2177064 Mar 20 17:40 mysql-community-libs-5.7.18-1.el6.x86_64.rpm
-rw-r--r-- 1 7155 31415 1723180 Mar 20 17:40 mysql-community-libs-compat-5.7.18-1.el6.x86_64.rpm
-rw-r--r-- 1 7155 31415 159060212 Mar 20 17:41 mysql-community-server-5.7.18-1.el6.x86_64.rpm
-rw-r--r-- 1 7155 31415 104881084 Mar 20 17:41 mysql-community-test-5.7.18-1.el6.x86_64.rpm
MYSQL学习4、使用rpm -ivh命令进行安装 MYSQL学习
[root@iZwz94qazh62gk5ewl4ei2Z mysql]# rpm -ivh mysql-community-common-5.7.18-1.el6.x86_64.rpm
warning: mysql-community-common-5.7.18-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature,key ID 5072e1f5: NOKEY
Preparing... ################################# [100%]
Updating / installing...
1:mysql-community-common-5.7.18-1.e################################# [100%]
[root@iZwz94qazh62gk5ewl4ei2Z mysql]# rpm -ivh mysql-community-libs-5.7.18-1.el6.x86_64.rpm
warning: mysql-community-libs-5.7.18-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature,key ID 5072e1f5: NOKEY
Preparing... ################################# [100%]
Updating / installing...
1:mysql-community-libs-5.7.18-1.el6################################# [100%]
[root@iZwz94qazh62gk5ewl4ei2Z mysql]# rpm -ivh mysql-community-client-5.7.18-1.el6.x86_64.rpm
warning: mysql-community-client-5.7.18-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature,key ID 5072e1f5: NOKEY
Preparing... ################################# [100%]
Updating / installing...
1:mysql-community-client-5.7.18-1.e################################# [100%]
[root@iZwz94qazh62gk5ewl4ei2Z mysql]# rpm -ivh mysql-community-server-5.7.18-1.el6.x86_64.rpm
warning: mysql-community-server-5.7.18-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature,key ID 5072e1f5: NOKEY
Preparing... ################################# [100%]
Updating / installing...
1:mysql-community-server-5.7.18-1.e################################# [100%]
[root@iZwz94qazh62gk5ewl4ei2Z mysql]#
MYSQL学习上面几个包有依赖关系,执行有先后. MYSQL学习使用rpm安装方式安装mysql,安装的路径如下: MYSQL学习
a 数据库目录
/var/lib/mysql/
b 配置文件
/usr/share/mysql(mysql.server命令及配置文件)
c 相关命令
/usr/bin(mysqladmin mysqldump等命令)
d 启动脚本
/etc/rc.d/init.d/(启动脚本文件mysql的目录)
e /etc/my.conf
MYSQL学习5、 数据库初始化 MYSQL学习为了保证数据库目录为与文件的所有者为 mysql 登陆用户,如果你的linux系统是以 root 身份运行 mysql 服务,需要执行下面的命令初始化 MYSQL学习
[root@iZwz94qazh62gk5ewl4ei2Z mysql]# mysqld --initialize --user=mysql
MYSQL学习如果是以 mysql 身份登录运行,则可以去掉 --user 选项. MYSQL学习另外 --initialize 选项默认以“平安”模式来初始化,则会为 root 用户生成一个密码并将该密码标记为过期,登陆后你需要设置一个新的密码, MYSQL学习而使用 MYSQL学习这里演示使用的 --initialize 初始化的,会生成一个 root 账户暗码,暗码在log文件里,红色区域的就是自动生成的暗码 MYSQL学习
[root@iZwz94qazh62gk5ewl4ei2Z mysql]# cat /var/log/mysqld.log
2017-06-05T14:30:52.709474Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2017-06-05T14:30:55.590590Z 0 [Warning] InnoDB: New log files created,LSN=45790
2017-06-05T14:30:56.000269Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2017-06-05T14:30:56.109868Z 0 [Warning] No existing UUID has been found,so we assume that this is the first time that this server has been started. Generating a new UUID: 960c533e-49fb-11e7-91f2-00163e089fd2.
2017-06-05T14:30:56.116186Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2017-06-05T14:30:56.116777Z 1 [Note] A temporary password is generated for root@localhost: :Wu?2QQutQwj
MYSQL学习?现在启动mysql数据库 MYSQL学习
[root@iZwz94qazh62gk5ewl4ei2Z mysql]# systemctl start mysqld.service
MYSQL学习可以使用下面两个命令对mysql进行停止,启动和重启: MYSQL学习启动: MYSQL学习使用 service 启动:service mysqld start MYSQL学习停止: MYSQL学习使用 service 启动:service mysqld stop MYSQL学习重启: MYSQL学习使用 service 启动:service mysqld restart MYSQL学习连接数据库 MYSQL学习[root@iZwz94qazh62gk5ewl4ei2Z mysql]# mysql -u root -p MYSQL学习暗码输入:? :Wu?2QQutQwj MYSQL学习修改暗码: MYSQL学习set password = password('你的暗码'); MYSQL学习
grant all privileges on *.* to 'root' @'%' identified by '123456';
flush privileges;
MYSQL学习设置mysql开机启动 MYSQL学习加入到系统服务: MYSQL学习
chkconfig --add mysql
MYSQL学习自动启动: MYSQL学习
chkconfig mysql on
MYSQL学习查询列表: MYSQL学习
chkconfig
MYSQL学习说明:都没关闭(off)时是没有自动启动. MYSQL学习以上所述是小编给大家介绍的阿里云 Centos7.3安装mysql5.7.18 rpm安装教程,希望对大家有所赞助,如果大家有任何疑问请给我留言,小编会及时回复大家的.在此也非常感谢大家对编程之家PHP网站的支持! 《Mysql应用阿里云 Centos7.3安装mysql5.7.18 rpm安装教程》是否对您有启发,欢迎查看更多与《Mysql应用阿里云 Centos7.3安装mysql5.7.18 rpm安装教程》相关教程,学精学透。编程之家 52php.cn为您提供精彩教程。 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |