第一章:基本安装步骤
第一步:下载并解压
wget https://downloads.mariadb.org/interstitial/mariadb-10.0.6/kvm-tarbake-jaunty-x86/mariadb-10.0.6.tar.gz wget mariadb-10.0.6.tar.gz tar zxvf mariadb-10.0.6.tar.gz cd mariadb-10.0.6
第二步:编译并安装
sudo apt-get install cmake libncurses5-dev g++ bison libssl-dev libxml2-dev libboost-dev cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mariadb make make install
第三步:创建“新数据库”并启动和登录“数据库服务器”
/usr/local/mariadb/scripts/mysql_install_db --basedir=/usr/local/mariadb --datadir=/usr/local/mariadb/data /usr/local/mariadb/bin/mysqld_safe --datadir='/usr/local/mariadb/data' /usr/local/mariadb/bin/mysql -uroot -p
第四步:授权超级用户adm、从复制用户replicationslave、关机用户shutdown
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '您的密码' WITH GRANT OPTION; GRANT REPLICATION SLAVE ON *.* TO 'replicationslave'@'%' IDENTIFIED BY 'firadio'; GRANT SHUTDOWN ON *.* TO 'shutdown'@'localhost' IDENTIFIED BY 'firadio';
第二章:常用数据库服务器管理
第一点:重启数据库服务器
/usr/local/mariadb/bin/mysqladmin -ushutdown -pfiradio shutdown /usr/local/mariadb/bin/mysqld_safe --datadir='/usr/local/mariadb/data' &
第二点:使其数据库同步
CHANGE MASTER TO MASTER_HOST='192.168.122.11',MASTER_PORT=3306,
MASTER_USER='replicationslave',MASTER_PASSWORD='firadio',
MASTER_CONNECT_RETRY=10,MASTER_LOG_FILE='mysql-bin.000001', MASTER_LOG_POS=1779;
第三章:常用数据库my.cnf配置
第一点:主服务器配置
[mysqld] server-id=40116 log-bin=mysql-bin replicate_wild_do_table=firadio_user.%
第二点:从服务器配置
[mysqld] server-id=40162 replicate-rewrite-db="firadio_user->96dt_radio" replicate-do-db=96dt_radio