安装mysql

Posted pigfly

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了安装mysql相关的知识,希望对你有一定的参考价值。

1.前言

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

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

 

2.开始安装

[[email protected] ~]# cd /usr/local/src
[[email protected] src]# wget https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm
[[email protected] src]# yum localinstall mysql57-community-release-el7-11.noarch.rpm
[[email protected] 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
[[email protected] src]# yum install mysql-community-server
[[email protected] src]# service mysqld start #启动mysql
[[email protected] 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.

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

  

以上是关于安装mysql的主要内容,如果未能解决你的问题,请参考以下文章

从mysql的片段中加载ListView

连接MySQL出现错误:ERROR 1045 (28000): Access denied for user ‘root‘@‘localhost‘ (using password: YES)(代码片段

使用 json rereiver php mysql 在片段中填充列表视图

在Tomcat的安装目录下conf目录下的server.xml文件中增加一个xml代码片段,该代码片段中每个属性的含义与用途

PHP代码-psysh调试代码片段工具

关于mysql驱动版本报错解决,Cause: com.mysql.jdbc.exceptions.jdbc4Unknown system variable ‘query_cache_size(代码片段