XAMPP 中使用Mysql 8 替换 MariaDB

838 阅读1分钟

必备

备份

  • 备份 XAMPP 下的数据库的数据
    • 例如,使用命令行登录已存在的数据库,dump所有数据
  • 将 XAMPP 目录下旧的 mysql 目录重命名未 mariadb

安装

  • 从 mysql 官方网站下载可以解压的mysql 8安装包: dev.mysql.com/downloads/m…
  • 认证检查你想要的版本,例如: mysql 8
  • 解压到 xampp\mysql目录下
  • 建立一个新文件: c:\xampp\mysql\bin\my.ini
[mysqld]
# Set basedir to your installation path
basedir=c:/xampp/mysql

# Set datadir to the location of your data directory
datadir=c:/xampp/mysql/data

# Default: 128 MB
# New: 1024 MB
innodb_buffer_pool_size = 1024M

# Default since MySQL 8: caching_sha2_password
default_authentication_plugin=mysql_native_password

[client]
ssl-mode=DISABLED
  • 初始化 mysql 8 的数据目录( 一定不能错过的步骤
cd c:\xampp\mysql\bin
mysqld.exe --default-authentication-plugin=mysql_native_password --initialize-insecure --basedir=c:\xampp\mysql --datadir=c:\xampp\mysql\data