MariaDB数据库管理系统是MySQL的一个分支,主要由开源社区在维护,采用GPL授权许可。开发这个分支的原因之一是:Oracle公司收购了MySQL后,有将MySQL闭源的潜在风险,因此社区采用分支的方式来避开这个风险。 MariaDB的目的是完全兼容MySQL,包括API和命令行,使之能轻松成为MySQL的代替品。在存储引擎方面,使用XtraDB来代替MySQL的InnoDB。 MariaDB由MySQL的创始人Michael Widenius主导开发,他早前曾以10亿美元的价格,将自己创建的公司MySQL AB卖给了SUN,此后,随着SUN被Oracle收购,MySQL的所有权也落入Oracle的手中。MariaDB名称来自Michael Widenius的女儿Maria的名字。 2008年,Sun收购MySQL,然后2010年Oracle又收购了Sun,MySQL落入了Oracle手中。Oracle与开源社区关系的一直不太好,将MySQL弄成了社区版和企业版,不能免费商业使用。MySQL企业版的新功能不公开源代码,这样让用户很不爽。MariaDB 则没有这方面的问题。 有必要从MySQL切换到MariaDB实例:
与MySQL相比,MariaDB的优势在于:
cd /home/keege/share mariadb-10.0.10.tar.gz groupadd mysql useradd -M -s /sbin/nologin -g mysql mysql mkdir -p /data/mariadb chown mysql.mysql -R /data/mariadb tar xzf cmake-2.8.11.2.tar.gz cd cmake-2.8.11.2 ./configure make && make install cd .. tar zxf mariadb-10.0.10.tar.gz cd mariadb-10.0.10cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mariadb \ -DMYSQL_UNIX_ADDR=/tmp/mysql.sock \ -DMYSQL_DATADIR=/data/mariadb \ -DSYSCONFDIR=/etc \ -DMYSQL_USER=mysql \ -DMYSQL_TCP_PORT=3306 \ -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 \ -DWITH_READLINE=1 \ -DENABLED_LOCAL_INFILE=1 \ -DWITH_EXTRA_CHARSETS=1 \ -DDEFAULT_CHARSET=utf8 \ -DDEFAULT_COLLATION=utf8_general_ci \ -DEXTRA_CHARSETS=all \ -DWITH_BIG_TABLES=1 \ -DWITH_DEBUG=0 make && make install #加入到service中 /bin/cp support-files/my-small.cnf /etc/my.conf /bin/cp support-files/mysql.server /etc/init.d/mysqld chmod +x /etc/init.d/mysqld #开机自启动 chkconfig --add mysqld chkconfig mysqld on cd .. 或者vi /etc/rc.local,把/etc/init.d/mysqld添加到文件末尾 # my.cf cat > /etc/my.cnf << EOF [mysqld] basedir = /usr/local/mariadb datadir = /data/mariadb pid-file = /data/mariadb/mariadb.pid character-set-server = utf8 collation-server = utf8_general_ci user = mysql port = 3306 default_storage_engine = InnoDB innodb_file_per_table = 1 server_id = 1 log_bin = mysql-bin binlog_format = mixed expire_logs_days = 7 bind-address = 0.0.0.0 # name-resolve skip-name-resolve skip-host-cache #lower_case_table_names = 1 ft_min_word_len = 1 query_cache_size = 64M query_cache_type = 1 skip-external-locking key_buffer_size = 16M max_allowed_packet = 1M table_open_cache = 64 sort_buffer_size = 512K net_buffer_length = 8K read_buffer_size = 256K read_rnd_buffer_size = 512K myisam_sort_buffer_size = 8M # LOG log_error = /data/mariadb/mariadb-error.log long_query_time = 1 slow_query_log slow_query_log_file = /data/mariadb/mariadb-slow.log # Oher #max_connections = 1000 open_files_limit = 65535 [client] port = 3306 EOF /usr/local/mariadb/scripts/mysql_install_db --user=mysql --basedir=/usr/local/mariadb --datadir=/data/mariadb chown mysql.mysql -R /data/mariadb /sbin/service mysqld start export PATH=$PATH:/usr/local/mariadb/bin echo 'export PATH=$PATH:/usr/local/mariadb/bin' >> /etc/profile source /etc/profile /usr/local/mariadb/bin/mysql -e "grant all privileges on *.* to root@'127.0.0.1' identified by "dbrootpwd" with grant option;" /usr/local/mariadb/bin/mysql -e "grant all privileges on *.* to root@'localhost' identified by "dbrootpwd" with grant option;" /usr/local/mariadb/bin/mysql -uroot -pdbrootpwd -e "delete from mysql.user where Password='';" /usr/local/mariadb/bin/mysql -uroot -pdbrootpwd -e "delete from mysql.db where User='';" /usr/local/mariadb/bin/mysql -uroot -pdbrootpwd -e "drop database test;" /sbin/service mysqld restart mysql -u root -p 以root用户登陆mysql create database jiradb character set utf8; //重要,建立数据库utf8。官网安装一再强调 create user 'jira'@'localhost' identified by 'jira';//建立用户 grant all privileges on jiradb.* to 'jira'@'localhost';//赋权限 create user 'jira'@'keege-PC' identified by 'jira'; grant all privileges on jiradb.* to 'jira'@' keege-PC '; |