yum -y install cmake 安装 cmake 工具
执行 cmake 命令进行编译
cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mariadb
-DMYSQL_DATADIR=/var/data/mariadb
-DMYSQL_UNIX_ADDR=/tmp/mysql.sock
-DWITH_XTRADB_STORAGE_ENGINE=1
-DWITH_INNOBASE_STORAGE_ENGINE=1
-DWITH_PARTITION_STORAGE_ENGINE=1
-DWITH_BLACKHOLE_STORAGE_ENGINE=1
-DWITH_MYISAM_STORAGE_ENGINE=1
-DDEFAULT_CHARSET=utf8
-DDEFAULT_COLLATION=utf8_general_ci
-DEXTRA_CHARSETS=all
-DENABLED_LOCAL_INFILE=1
-DWITH_READLINE=1
-DWITH_EXTRA_CHARSETS=1
-DWITH_SSL=bundled
-DWITH_ZLIB=bundled
报错信息:
cc: internal compiler error: Killed (program cc1)
或者
g++: internal compiler error: Killed (program cc1plus)
Please submit a full bug report,
主要原因大体上是因为
内存不足,有点坑 临时使用交换分区来解决吧
创建 swap 交换分区
dd if=/dev/zero of=/swapfile bs=64M count=16
mkswap /swapfile
swapon /swapfile
下面是执行 make 命令过程中内存使用情况
结束后可以关闭交换分区
swapoff /swapfile
rm /swapfile
初始化数据库(进入到scripts目录下)
./mysql_install_db --user=mysql --basedir=/usr/local/mariadb --datadir=/var/data/mariadb
下面是初始化完成后提示的信息:
To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system
PLEASE REMEMBER TO SET A PASSWORD FOR THE MariaDB root USER !
To do so, start the server, then issue the following commands:
'/usr/local/mariadb/bin/mysqladmin' -u root password 'new-password'
'/usr/local/mariadb/bin/mysqladmin' -u root -h iZ287rk6ob4Z password 'new-password'
Alternatively you can run:
'/usr/local/mariadb/bin/mysql_secure_installation'
which will also give you the option of removing the test
databases and anonymous user created by default. This is
strongly recommended for production servers.
See the MariaDB Knowledgebase at http://mariadb.com/kb or the
MySQL manual for more instructions.
You can start the MariaDB daemon with:
cd '/usr/local/mariadb' ; /usr/local/mariadb/bin/mysqld_safe --datadir='/var/data/mariadb'
You can test the MariaDB daemon with mysql-test-run.pl
cd '/usr/local/mariadb/mysql-test' ; perl mysql-test-run.pl
Please report any problems at http://mariadb.org/jira
The latest information about MariaDB is available at http://mariadb.org/.
You can find additional information about the MySQL part at:
启动数据库
将 support-files 下的 my.small.cnf 复制到 /etc/ 下改名为 my.cnf,并修改相应的配置信息
./bin/mysqld --user=mysql
修改 root 密码
./bin/mysqladmin -u root password 'new-password'
恢复备份,下面两步需要登录 MySQL
导入备份数据
source back.sql;
刷新权限
flush privileges;