MariaDB的特性;
插件式存储引擎:存储管理有多重实现版本,功能和特性可能均略有差别;用户可以根据需求灵活选择;
存储引擎也称为表类型
1.更多的存储的存储引擎
MyISAM-->Aria
InnoDB-->XtraDB
2.诸多扩展和新特性
3.提供了较多测试组件
4.truly open source
安装和使用Mariadb
Centos 7 直接yum安装
Centos 6 编译安装
通用二进制格式安装;
1.准备数据目录
以/mydata/data为例
2.配置mariadb
groupadd -r -g 300 mysql
useradd -r -g 306 -u mysql
tar xf mariadb.tax.xz -C /usr/local
ln -sv mariadb mysql
cd /usr/local/mysql
chown -R root:mysql ./*
scripts/mysql_install_db --datadir=/mydata/data --user=mysql
cp supper-files/mysql.server /etc/rc.d/init.d/mysqld
chkconfig --add mysqld
msyql安全初始化
./mysql_secure_installation
3.准备配置文件
配置文件格式:类ini格式,为各程序均通过单个配置文件提供配置信息;
配置文件查找次序;
/etc/my.cnf-->/etc/mysql/my.cnf-->--default-extra-file=/PATH/TO/CONF_FILE--->~/.my.cnf
mkdir /etc/mysql
cp support-files/my-large.cnf /etc/mysql/my.cnf
添加三个选项:
datadir=/mydata/data
innodb_file_per_table=on
skip_name_resolve=on
mariadb的程序组成:
c:mysql
mysqldump,mysqladmin
s:mysqld_safe
mysqld
mysqld_multi
两种socket地址;
ip socket
unix sock
mysql客户端命令
mysql>help
? (\?) Synonym for `help‘.
clear (\c) Clear the current input statement.
connect (\r) Reconnect to the server. Optional arguments are db and host.
delimiter (\d) Set statement delimiter.
edit (\e) Edit command with $EDITOR.
ego (\G) Send command to mysql server, display result vertically.
exit (\q) Exit mysql. Same as quit.
go (\g) Send command to mysql server.
help (\h) Display this help.
nopager (\n) Disable pager, print to stdout.
notee (\t) Don‘t write into outfile.
pager (\P) Set PAGER [to_pager]. Print the query results via PAGER.
print (\p) Print current command.
prompt (\R) Change your mysql prompt.
quit (\q) Quit mysql.
rehash (\#) Rebuild completion hash.
source (\.) Execute an SQL script file. Takes a file name as an argument.
status (\s) Get status information from the server.
system (\!) Execute a system shell command.
tee (\T) Set outfile [to_outfile]. Append everything into given outfile.
use (\u) Use another database. Takes database name as argument.
charset (\C) Switch to another charset. Might be needed for processing binlog with multi-byte charsets.
warnings (\W) Show warnings after every statement.
nowarning (\w) Don‘t show warnings after every statement.
服务器命令:每个命令都要有结束符号,默认;
select,update,delete......
创建数据库;
CREATE DATABASE ‘DB_NAME‘
CHARACTER SET ‘charecter set name‘
COLLATE ‘collate name‘
show character set;查看所有支持的字符集
show collation; 排序规则
创建表;
CREATE TABLE talbe_name (col1 ,col12.....)
查看命令帮助
HELP keyword
help select
查看用户权限
show grants for ‘root‘@‘localhost‘;
查看当前用户权限
show grants for current_user;