maria数据库是mysql原作者另外开发的一个版本,使用方法和mysql一样,可以直接用mysql的库连接.
在这下载包并解压:
https://mariadb.org/download/
建立数据库文件夹,并分配给www账户(安装网站服务端的时候说过如何建立账户):
mkdir /home/mariadb
chown -R mysql:mysql /home/mariadb
编译:
cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/home/mariadb -DSYSCONFDIR=/etc -DWITHOUT_TOKUDB=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_ARCHIVE_STPRAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DWIYH_READLINE=1 -DWIYH_SSL=system -DVITH_ZLIB=system -DWITH_LOBWRAP=0 -DMYSQL_UNIX_ADDR=/tmp/mysql.sock -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci
make -j2
make install
配置:
cd /usr/local/mysql/
chown -R mysql:mysql . (←注意后面的'点')
cp ./support-files/my-huge.cnf /home/wwwroot/etc/mariadb-10.0.20.cnf
scripts/mysql_install_db --datadir=/home/mariadb --user=mysql
chown -R root .
mkdir /var/log/mariadb
cp support-files/mysql.server /etc/init.d/mysqld
ln -s /var/lib/mysql/mysql.sock /tmp/mysql.sock
[Unit] Description=MariaDB Server After=network.target [Service] User=mysql Group=mysql PIDFile=/tmp/mariadb.pid ExecStart=/usr/local/mariadb/bin/mysqld_safe --user=mysql --datadir=/home/mariadb --pid-file=/tmp/mariadb.pid [Install] WantedBy=multi-user.target
配置密码:
mysqladmin' -u root password 'new-password'