1. 下载并解压 noinstall 压缩包,假设解压到 D:\MariaDB 目录

下载地址(5.1.44b):http://download.mysql.cn/src/2012/0725/5618.html

2. 创建配置文件 my.ini (c:\mariadb-5.5.31-win32\my.ini)
这个文件可直接从 c:\
mariadb-5.5.31-win32 目录下的 my-xxx.ini 随便复制一个过来改动,只需要增加几个配置项即可,分别是:

[mysqldump]
quick
max_allowed_packet = 16M
basedir=C:\\mariadb-5.5.31-win32
datadir=C:\\mariadb-5.5.31-win32\\data
default-character-set=utf8
[mysql]
no-auto-rehash
default-character-set=utf8
# Remove the next comment character if you are not familiar with SQL
#safe-updates


3. 第一次启动 MariaDB

在 D:\MariaDB\bin 目录下运行 mysqld --console 以控制台模式启动数据库服务器,此步骤将会在 data 目录创建数据文件和日志文件

C:\mariadb-5.5.31-win32\bin>mysqld --console
140112  0:15:23 InnoDB: The InnoDB memory heap is disabled
140112  0:15:23 InnoDB: Mutexes and rw_locks use Windows interlocked functions
140112  0:15:23 InnoDB: Compressed tables use zlib 1.2.3
140112  0:15:23 InnoDB: Initializing buffer pool, size = 128.0M
140112  0:15:23 InnoDB: Completed initialization of buffer pool
InnoDB: The first specified data file .\ibdata1 did not exist:
InnoDB: a new database to be created!
140112  0:15:23  InnoDB: Setting file .\ibdata1 size to 10 MB
InnoDB: Database physically writes the file full: wait...
140112  0:15:24  InnoDB: Log file .\ib_logfile0 did not exist: new to be created
InnoDB: Setting log file .\ib_logfile0 size to 5 MB
InnoDB: Database physically writes the file full: wait...
140112  0:15:25  InnoDB: Log file .\ib_logfile1 did not exist: new to be created
InnoDB: Setting log file .\ib_logfile1 size to 5 MB
InnoDB: Database physically writes the file full: wait...
InnoDB: Doublewrite buffer not found: creating new
InnoDB: Doublewrite buffer created
InnoDB: 127 rollback segment(s) active.
InnoDB: Creating foreign key constraint system tables
InnoDB: Foreign key constraint system tables created
140112  0:15:27  InnoDB: Waiting for the background threads to start
140112  0:15:28 Percona XtraDB (http://www.percona.com) 5.5.31-MariaDB-30.2 star
ted; log sequence number 0
140112  0:15:28 [Note] Plugin 'FEEDBACK' is disabled.
140112  0:15:29 [Note] Server socket created on IP: '0.0.0.0'.
140112  0:15:29 [Note] Event Scheduler: Loaded 0 events
140112  0:15:29 [Note] mysqld: ready for connections.
Version: '5.5.31-MariaDB'  socket: ''  port: 3306  mariadb.org binary distributi
on

以上服务必须console口服务必须开启否则登陆不了DB。

wKiom1LRc7SxR1S9AAJF31xUOdo146.jpg

4. 将 MariaDB 安装为 Windows 服务

同样在 D:\MariaDB\bin 目录下运行 mysqld --install 则会创建名为 MySQL 的 Windows 服务,如果你已经装有 MySQL 则会提示服务名已存在,那么可以用 mysqld --install MariaDB 来创建名为 MariaDB 的服务,也可以使用其他服务名。

C:\mariadb-5.5.31-win32\bin>mysqld --install MariaDB
Service successfully installed.

创建完的服务并没有启动,并且启动类型设置为自动启动。

5. 启动后的 MariaDB 默认有一个 root 用户,访问密码为空。

修改密码方法:mysqladmin -u root password "新密码"

C:\mariadb-5.5.31-win32\bin>mysqladmin -u root password
New password: *****
Confirm new password: *****

wKioL1LRc7uCjg2LAAENI2fbd6c234.jpg

6.测试安装是否正常。

C:\> C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqlshow


C:\> C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqlshow -u root mysql
C:\> C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqladmin version status proc
C:\> C:\Program Files\MySQL\MySQL Server 5.1\bin\mysql test

具体各家操作系统安装参考配置文档:

http://tool.oschina.net/apidocs/apidoc?api=mysql-5.1-zh