要在openEuler 22.03-LTS上搭建MySQL数据库服务并修改端口号为7775,root密码设置为xwfz2023,并允许外部连接,可以按照以下步骤进行操作:

  1. 安装MySQL数据库服务:

    $ sudo dnf install mysql-server
    
  2. 启动MySQL服务:

    $ sudo systemctl start mysqld
    
  3. 设置MySQL服务开机自启:

    $ sudo systemctl enable mysqld
    
  4. 修改MySQL配置文件,将端口号修改为7775:

    $ sudo vi /etc/my.cnf
    

    在文件中找到[mysqld]部分,添加或修改以下行:

    port = 7775
    
  5. 重启MySQL服务使配置生效:

    $ sudo systemctl restart mysqld
    
  6. 运行MySQL安全性脚本以设置root密码:

    $ sudo mysql_secure_installation
    

    按照提示设置root密码(例如xwfz2023)。

  7. 允许外部连接:

    • 编辑MySQL配置文件:
      $ sudo vi /etc/my.cnf
      
    • 在文件中找到[mysqld]部分,添加或修改以下行:
      bind-address = 0.0.0.0
      
      这将允许来自任何IP地址的外部连接。
  8. 重启MySQL服务使配置生效:

    $ sudo systemctl restart mysqld
    

现在,你已经在openEuler 22.03-LTS上成功搭建了MySQL数据库服务,并修改了端口号为7775,root密码设置为xwfz2023,并允许了外部连接

openEuler 2203-LTS 搭建MySQL数据库服务并修改端口号为7775root密码设置为xwfz2023 同时运行外部连接 给出具体指令

原文地址: https://www.cveoy.top/t/topic/hNKl 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录