Home > Database > Mysql Tutorial > Linux CentOS安装配置MySQL数据库

Linux CentOS安装配置MySQL数据库

PHPz
Release: 2018-09-30 10:48:29
forward
1256 people have browsed it

没什么好说的,直接正面刚吧。

安装mysql数据库

  a)下载mysql源安装包:wget http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm

  b)安装mysql源:yum localinstall mysql57-community-release-el7-8.noarch.rpm

    若结尾出现complete!,则说明MySQL源安装完成

   c)检测是否安装完成:yum repolist enabled | grep "mysql.*-community.*"

  

  d)安装mysql:yum install mysql-community-server

    若结尾出现Complete!, 则MySQL安装完成

  e)设置开启启动mysql服务:systemctl enable mysqld

   f)查看安装的mysql版本:rpm -aq | grep -i mysql

    

  g)启动MySQL服务:systemctl restart mysqld

  h)查看MySQL初始密码:grep 'A temporary password' /var/log/mysqld.log

    

  i)更改MySQL密码:mysqladmin -u root -p'旧密码' password '新密码'

    

    这里更改密码出了问题,更改失败,这是因为密码太过简单的原因。有两个接解决方法:

    方法一:把密码设置复杂点(这是最直接的方法)

    方法二:关闭mysql密码强度验证(validate_password)

        编辑配置文件:vim /etc/my.cnf, 增加这么一行validate_password=off

        编辑后重启mysql服务:systemctl restart mysqld

  j)设置mysql能够远程访问:

    登录进MySQL:mysql -uroot -p密码

     增加一个用户给予访问权限:grant all privileges on *.* to 'root'@'ip地址' identified by '密码' with grant option; //可将ip改为%%,表示开启所有的

    

    刷新权限:flush privileges;­

    OK,我本地连接试下。

    

好了,到这里就结束了,祝大家别出BUG。

更多相关教程请访问 MySQL视频教程

Related labels:
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
MySQL stops process
From 1970-01-01 08:00:00
0
0
0
Error when installing mysql on linux
From 1970-01-01 08:00:00
0
0
0
phpstudy cannot start mysql?
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template