CentOS6.9下安装MariaDB10.2.11
yum groupinstall -y "Development Tools"
yum install -y cmake openssl-devel zlib-devel
yum install -y ncurses-devel
groupadd mysql
useradd mysql -g mysql
mkdir -p /usr/local/mysql
mkdir -p /db/mysql/data
mkdir -p /usr/software
chown -R mysql:mysql /usr/local/mysql
chown -R mysql:mysql /db/mysql/data
chown -R mysql:mysql /usr/local/mysql/.
chown -R mysql:mysql /db/mysql/data/.
echo "PATH=/usr/local/mysql/bin:/usr/local/mysql/lib:\$PATH" >> /etc/profile
echo "export PATH" >> /etc/profile
source /etc/profile
cd /usr/software/
yum install ntpdate -y
yum install wget -y
ntpdate time.windows.com && hwclock -w
#如果执行出错,试试下面这个命令
ntpdate -d time.nist.gov && hwclock -w
wget http://mirrors.neusoft.edu.cn/mariadb/mariadb-10.2.11/source/mariadb-10.2.11.tar.gz
tar -zxvf mariadb-10.2.11.tar.gz
cd /usr/software/mariadb-10.2.11
cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_UNIX_ADDR=/usr/local/mysql/mysql.sock -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_SPHINX_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DENABLED_LOCAL_INFILE=1 -DMYSQL_DATADIR=/db/mysql/data -DMYSQL_USER=mysql -DMYSQL_TCP_PORT=22066
make && make install
cp /usr/local/mysql/support-files/my-medium.cnf /etc/my.cnf
vi /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 192.168.1.100 ffmpeg
检查一下是不是能正常查找到主机名称了:
/usr/local/mysql/bin/resolveip ffmpeg
IP address of ffmpeg is 192.168.1.100
cd /usr/local/mysql
scripts/mysql_install_db --user=mysql --datadir=/db/mysql/data
===============================================================
vi /etc/my.cnf
[client] port = 22066 socket = /usr/local/mysql/mysql.sock [mysqld] port = 22066 socket = /usr/local/mysql/mysql.sock skip-external-locking skip-name-resolve back_log = 50 max_connections = 1024 max_connect_errors = 1000 table_open_cache = 1024 open_files_limit=16384 max_allowed_packet = 16M binlog_cache_size = 1M max_heap_table_size = 64M read_buffer_size = 2M read_rnd_buffer_size = 2M sort_buffer_size = 2M join_buffer_size = 2M thread_cache_size = 64 query_cache_size = 64M query_cache_limit = 4M wait_timeout=35 interactive_timeout=35 ft_min_word_len = 4 default-storage-engine = InnoDB thread_stack = 240K transaction_isolation = REPEATABLE-READ tmp_table_size = 32M log-bin=mysql-bin expire_logs_days=3 binlog_format=ROW server-id = 1 slow_query_log long_query_time = 2 log_bin_trust_function_creators=1 group_concat_max_len=200000 lower_case_table_names=1 innodb_file_per_table=1 #*** MyISAM Specific options key_buffer_size = 32M bulk_insert_buffer_size = 64M myisam_sort_buffer_size = 128M myisam_max_sort_file_size = 10G myisam_repair_threads = 1 myisam_recover_options=force,backup # *** INNODB Specific options *** innodb_open_files=1024 innodb_buffer_pool_size = 2G innodb_data_file_path = ibdata1:10M:autoextend innodb_write_io_threads = 8 innodb_read_io_threads = 8 innodb_thread_concurrency = 8 innodb_flush_log_at_trx_commit = 1 innodb_log_buffer_size = 4M innodb_log_file_size = 256M innodb_log_files_in_group = 3 innodb_max_dirty_pages_pct = 90 innodb_lock_wait_timeout = 120 [mysqldump] quick max_allowed_packet = 16M [mysql] no-auto-rehash [myisamchk] key_buffer_size = 512M sort_buffer_size = 512M read_buffer_size = 8M write_buffer_size = 8M [mysqlhotcopy] interactive-timeout [mysqld_safe] open-files-limit = 8192
配置自动启动
\cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysql chmod +x /etc/init.d/mysql chkconfig --level 345 mysql on
===============================================================
service mysql start
chkconfig mysql on
mysqladmin -u root password 'dsideal'
service iptables stop
chkconfig iptables off
mysql -uroot -pdsideal
GRANT ALL PRIVILEGES ON *.* TO root@"%" IDENTIFIED BY "dsideal";
flush privileges;
数据库的备份与还原