mariadb

MariaDB數據庫管理系統是MySQL的一個分支,主要由開源社區在維護,採用GPL受權許可 MariaDB的目的是徹底兼容MySQL,包括API和命令行,使之能輕鬆成爲MySQL的代替品。在存儲引擎方面,使用XtraDB來代替MySQL的InnoDBmysql


實驗環境sql

centos6.9_x64  192.168.10.15數據庫


實驗軟件centos

mariadb-10.1.22.tar.gztcp


軟件安裝ide

yum remove -y mysql命令行

yum install -y libevent libevent-devel curses curses-devel openssl-devel openssl lrzsz gcc make cmake 3d

yum groupinstall -y Development Toolsrest


groupadd mysql && useradd -r -g mysql mysqlorm

mkdir -pv /usr/local/mariadb && mkdir -pv /usr/local/mariadb/data


tar zxvf /root/mariadb-10.1.22.tar.gz

cd /root/mariadb-10.1.22

cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mariadb \

   -DMYSQL_UNIX_ADDR=/tmp/mysql.sock \

   -DMYSQL_DATADIR=/usr/local/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 \

   -DCURSES_LIBRARY=/usr/lib/libncurses.so \

   -DCURSES_INCLUDE_PATH=/usr/include

make -j6 && make  install


cp -pv /root/mariadb-10.1.22/support-files/my-small.cnf /etc/my.cnf

cp -pv /root/mariadb-10.1.22/support-files/mysql.server /etc/init.d/mysqld

chmod +x /etc/rc.d/init.d/mysqld && chkconfig --level 35 mysql on

touch /usr/local/mariadb/data/mariadb-error.log

touch /usr/local/mariadb/data/mariadb-slow.log

chown -R mysql:mysql /usr/local/mariadb/


cp -pv /etc/my.cnf  /etc/my.cnf.bak

cat /etc/my.cnf

[mysqld]

basedir = /usr/local/mariadb

datadir = /usr/local/data/mariadb

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 = /usr/local/mariadb/data/mariadb-error.log

long_query_time = 1

slow_query_log

slow_query_log_file = /usr/local/mariadb/data/mariadb-slow.log


# Oher

#max_connections = 1000

open_files_limit = 65535


[client]

port = 3306


/usr/local/mariadb/scripts/mysql_install_db --user=mysql --basedir=/usr/local/mariadb --datadir=/usr/local/data/mariadb &

cp -pv /etc/profile /etc/profile.bak

echo 'export PATH=$PATH:/usr/local/mariadb/bin' >> /etc/profile && source  /etc/profile

tail -1 /etc/profile

export PATH=$PATH:/usr/local/mariadb/bin

service mysqld restart


netstat -tuplna | grep 3306

tcp        0      0 0.0.0.0:3306                0.0.0.0:*                   LISTEN      32752/mysqld

ps -ef | grep 3306

mysql     32752  32576  0 22:50 pts/0    00:00:00 /usr/local/mariadb/bin/mysqld --basedir=/usr/local/mariadb --datadir=/usr/local/data/mariadb --plugin-dir=/usr/local/mariadb/lib/plugin --user=mysql --log-error=/usr/local/mariadb/data/mariadb-error.log --open-files-limit=65535 --pid-file=/usr/local/data/mariadb/centos6.pid --port=3306

root      32790   7024  0 22:51 pts/0    00:00:00 grep 3306


mysql -uroot -p數據庫密碼

MariaDB [(none)]> GRANT ALL PRIVILEGES ON *.* TO root@"%" IDENTIFIED BY "root";  設置遠程訪問權限

MariaDB [mysql]> update user set Password = password('123.com') where User='root'; /mysqladmin -uroot  password 數據庫密碼  修改root密碼 

MariaDB [(none)]> flush privileges;


1.jpg


2.jpg

相關文章
相關標籤/搜索