• Debian install MySQL if use root remove command ‘sudo‘


    To install MySQL on a Debian system, you can use the apt package manager. Here's how you can do it:

    1. Update Your System: Before installing any package, it's a good practice to update your system's package repository information:

      sudo apt update
    2. Install MySQL Server:

      sudo apt install default-mysql-server

      This will install the MySQL server and other required packages. During the installation, you will be prompted to set a password for the MySQL root user. Ensure you remember this password, as you'll need it to administer your MySQL server later.

    3. Start and Enable MySQL:

      The MySQL service should start automatically after installation. You can check its status with:

      sudo systemctl status mysql

      To ensure MySQL starts upon boot, enable it with:

      sudo systemctl enable mysql
    4. Securing MySQL Installation:

      MySQL comes with a script that can help with securing your installation:

      sudo mysql_secure_installation

      Follow the on-screen prompts. It will allow you to set the root password, remove anonymous users, disallow root login remotely, and remove the test databases. It's recommended to say 'yes' to all prompts.

    5. Accessing MySQL:

      To log in to the MySQL server as the root user:

      sudo mysql -u root -p

      Enter the root password when prompted.

    6. Install MySQL Client (Optional):

      If you want to have the MySQL client software installed so you can connect to other MySQL servers, run:

      sudo apt install default-mysql-client

    That's it! You now have MySQL server installed and running on your Debian system. Remember, always backup your databases before making significant changes and always keep your server updated to receive the latest security patches.

    Q:

    1. root@:~# systemctl enable mysql
    2. Synchronizing state of mysql.service with SysV service script with /lib/systemd/systemd-sysv-install.
    3. Executing: /lib/systemd/systemd-sysv-install enable mysql
    4. Failed to enable unit: Too many levels of symbolic links

    a:

    mysqld.service和mysql.service都是为mariadb.service创建的别名,这是因为您的系统上安装了MariaDB而不是标准的MySQL。如果您想启用MariaDB服务,而不是MySQL服务,可以使用以下命令来启用它:
     

    1. systemctl enable mariadb.service
    systemctl daemon-reload

    远程连接问题

    centos7.6 yum 安装mysql_centos7.6 yum安装mysql_tenc1239的博客-CSDN博客

  • 相关阅读:
    [附源码]计算机毕业设计在线教育系统Springboot程序
    YOLOv8『小目标』检测指南
    centos7服务器安全基线检查和加固建议
    使用 Apache Kafka 实现 Quarkus 的反应式消息
    BetterZip for Mac2024最新mac解压缩软件
    基于循环神经网络空中目标意图识别实现(附源码)
    docker-compose概述与简单编排部署
    String formatting
    亚马逊,shopee,lazada自养号测评补单操作流程和技巧
    GIC/ITS代码分析(11)LPI中断虚拟化之概述
  • 原文地址:https://blog.csdn.net/tenc1239/article/details/133208729