markdown XAMPP - 用MySQL替换MariaDB

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了markdown XAMPP - 用MySQL替换MariaDB相关的知识,希望对你有一定的参考价值。

# XAMPP - Replacing MariaDB with MySQL

As of XAMPP 5.5.30 and 5.6.14, XAMPP ships MariaDB instead of MySQL.
[MariaDB is not 100% compatible with MySQL](https://mariadb.com/kb/en/mariadb/mariadb-vs-mysql-compatibility/) and can be replaced with the "orginal" MySQL server.

## Requirements

* Windows
* [XAMPP](https://www.apachefriends.org) for Windows

## Backup

* Backup the old database into a sql dump file
* Stop the MariaDB service
* Rename the folder: `c:\xampp\mysql` to `c:\xampp\mariadb`

## Installation

* Download MySQL Community Server: https://dev.mysql.com/downloads/mysql/
* Goto: Other Downloads > ZIP Archive	5.7.21 (mysql-5.7.21-win32.zip) > [No thanks, just start my download](https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.21-win32.zip).
* Create a new and empty folder: `c:\xampp\mysql`
* Extract `mysql-5.7.21-win32.zip` to: `c:\xampp\mysql`
* Create a new file: `c:\xampp\mysql\bin\my.ini` and copy this content:

```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
```

### Initializing the data directory

* Copy the old `data` directory from `c:\xampp\mariadb\data` to  `c:\xampp\mysql\data`

* Start the MySQL server. You can use the XAMPP Control Panel (MySQL > Start) to start the MySQL service.

* Repair all corrupted tables in the `c:\xampp\mysql\data` directory. Press ENTER if your password is empty.

```cmd
cd c:\xampp\mysql\bin
```

```cmd
mysqlcheck.exe -u root -p --auto-repair --all-databases
```

Update structure to latest version:

```cmd
mysql_upgrade.exe -u root -p
```

Check the tables for errors:
  
```cmd
mysqlcheck.exe -u root -p --check --all-databases
```

## Finished

Click the Github ★ Star button :-)

## Known issues

* I can't stop mysql using the button stop
* The XAMPP control panel is crashing while shutting down

Fix the directory permissions with this [batch script](https://gist.github.com/odan/eb6dd532a59956f4ae9b1216fa842271) 

以上是关于markdown XAMPP - 用MySQL替换MariaDB的主要内容,如果未能解决你的问题,请参考以下文章

MySQL命令,一篇文章替你全部搞定

为啥我们需要xampp在mysql中创建数据库??(用java连接它)

markdown 在XAMPP中配置别名

markdown Windows上的XAMPP

markdown 为XAMPP安装Xdebug

markdown 为XAMPP安装Xdebug