码迷,mamicode.com
首页 > 数据库 > 详细

安装mysql

时间:2017-10-26 13:29:00      阅读:338      评论:0      收藏:0      [点我收藏+]

标签:mmu   user   down   systemd   erp   密码验证   list   dev   style   

1.前言

本次安装方式采用yum repo,请前往官网下载对应的版本,由于我的虚拟机安装的是centos7,所以选择Red Hat Enterprise Linux 7 / Oracle Linux 7 (Architecture Independent), RPM Package,详细的安装步骤请参考mysql官网安装手册

当然,还有其他的安装方式,请参考mysql官网下载页面

 

2.开始安装

[root@localhost ~]# cd /usr/local/src
[root@localhost src]# wget https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm
[root@localhost src]# yum localinstall mysql57-community-release-el7-11.noarch.rpm
[root@localhost src]# yum repolist enabled | grep "mysql.*-community.*"
mysql-connectors-community/x86_64       MySQL Connectors Community           42
mysql-tools-community/x86_64            MySQL Tools Community                51
mysql57-community/x86_64                MySQL 5.7 Community Server          227
[root@localhost src]# yum install mysql-community-server
[root@localhost src]# service mysqld start #启动mysql
[root@localhost src]# service mysqld status #查看mysql状态,active(running)表示正在运行
Redirecting to /bin/systemctl status mysqld.service
● mysqld.service - MySQL Server
   Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
   Active: active (running) since Thu 2017-10-26 10:56:36 CST; 1h 5min ago
     Docs: man:mysqld(8)
           http://dev.mysql.com/doc/refman/en/using-systemd.html
  Process: 2062 ExecStart=/usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid $MYSQLD_OPTS (code=exited, status=0/SUCCESS)
  Process: 1989 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)
 Main PID: 2065 (mysqld)
   CGroup: /system.slice/mysqld.service
           └─2065 /usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid

Oct 26 10:56:30 localhost.localdomain systemd[1]: Starting MySQL Server...
Oct 26 10:56:36 localhost.localdomain systemd[1]: Started MySQL Server.

[root@localhost src]# grep ‘temporary password‘ /var/log/mysqld.log #查看mysql生成的临时密码
2017-10-26T02:56:33.310140Z 1 [Note] A temporary password is generated for root@localhost: LiLd_/uo/5Zr #这个就是root的临时密码
[root@localhost src]# mysql -uroot -p #用临时密码登陆
#修改root密码,由于默认开启了密码验证机制,mysql要求密码长度必须8位以上并带有大小写字母和特殊符号
mysql> ALTER USER ‘root‘@‘localhost‘ IDENTIFIED BY ‘%098NJImko‘;
Query OK, 0 rows affected (0.00 sec)

  

安装mysql

标签:mmu   user   down   systemd   erp   密码验证   list   dev   style   

原文地址:http://www.cnblogs.com/justlikeheaven/p/7735945.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!