安装MySQL:

  1. 更新系统软件包:sudo apt-get update
  2. 安装MySQL:sudo apt-get install mysql-server

配置MySQL:

  1. 启动MySQL服务:sudo service mysql start
  2. 设置root密码:sudo mysql -u root -p
  3. 创建新用户:GRANT ALL PRIVILEGES ON *.* TO '新用户名'@'%' IDENTIFIED BY '密码';
  4. 刷新权限:FLUSH PRIVILEGES;
  5. 退出MySQL:exit