zoukankan      html  css  js  c++  java
  • Install MySQL on CentOS 7

    原文:https://devops.profitbricks.com/tutorials/install-mysql-on-centos-7/

    1.下载mysql

    mysql官网选择适合的mysql版本(Red Hat Enterprise Linux 7 / Oracle Linux 7 for this tutorial) 点击 Download 。

    右键复制No thanks, just start my download.的链接。

    sudo rpm -Uvh http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
    

    2.安装mysql

    现在就可以用yum命令安装mysql了

    yum -y install mysql-community-server
    

    3.mysql的启动、重启、停止

    systemctl start mysqld #启动mysql服务
    systemctl restart mysqld #启动mysql服务
    systemctl stop mysqld #停止mysql服务
    systemctl enable mysqld #开机启动mysql服务
    systemctl status mysqld #查看mysql服务运行状态
    

    4. 初始化mysql

    mysql_secure_installation#命令将帮你安全初始化mysql 

    Set root password? [Y/n] Y

    Remove anonymous users? [Y/n] Y

    Disallow root login remotely? [Y/n] Y

    Remove test database and access to it? [Y/n] Y

    Reload privilege tables now? [Y/n] Y

    5.防火墙设置

    MySQL listens on TCP port 3306 by default.

    If the CentOS firewall is enabled, then a rule allowing access to the MySQL server on port 3306/tcp from host192.0.2.10 can be added.

    firewall-cmd --permanent --zone=trusted --add-source=192.0.2.10/32
    firewall-cmd --permanent --zone=trusted --add-port=3306/tcp
    firewall-cmd  --reload

    6.创建数据库用户

    The following steps will describe creating a new database named appdb and granting the appuser full access to the new database.

    Adjust the hostname from which the user will be connecting and password as necessary.

    mysql> create database appdb;
    mysql> grant all on appdb.* to 'appuser'@'localhost' identified by 'password';
    mysql> quit
  • 相关阅读:
    畅销书排行榜
    阿里云大数据产品体系
    天然气收费管理系统的研究与实现随笔
    Web端实现RTC视频特效的解决方案
    从0搭建在线聊天室,只需4步!
    技术干货 | JavaScript 之事件循环(Event Loop)
    C++20 四大特性之一:Module 特性详解
    Android Flutter 多实例实践
    网易云信线上万人连麦技术大揭秘
    Python + Pytest 自动化框架的用例依赖实操
  • 原文地址:https://www.cnblogs.com/Beyron/p/6222242.html
Copyright © 2011-2022 走看看