groupadd mysql
useradd -g mysql mysql
cd /usr/local
tar -zxvpf /path-to/mariadb-VERSION-OS.tar.gz
ln -s mariadb-VERSION-OS mysql
cd mysql
./scripts/mysql_install_db --user=mysql
chown -R root .
chown -R mysql data
./bin/mysqld_safe --user=mysql &
or
./bin/mysqld_safe --defaults-file=~/.my.cnf --user=mysql &
修改你的$PATH以便你调用mysql、mysqldump等进行连接测试。
export PATH=$PATH:/usr/local/mysql/bin/
你或更愿意通过修改.bashrc或.bash_profile文件来永久保存设置
用root帐户将MariaDB安装在任意目录
下面的操作将目录/usr/local更改到你选择的目录:
cd /usr/local
gunzip < /path-to/mariadb-VERSION-OS.tar.gz | tar xf -
ln -s mariadb-VERSION-OS mysql
cd mysql
./scripts/mysql_install_db --defaults-file=~/.my.cnf
? (\?) 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.#发送命令到mysql服务器#
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.##重新hash##
source (\.) Execute an SQL script file. Takes a file name as an argument. ##执行一个SQL脚本文件
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. ##使用其他数据库##
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.
mysql命令的使用帮助:
man mysql
mysql --help --verbose
sql脚本运行:
mysql [options] [DATABASE] < /PATH/FROM/SOME_SQL_SCRIPT
mysqld服务器程序:工作特性的定义方式: 命令行选项 配置文件参数
服务器参数/变量:设定MySQL的运行特性;
mysql> SHOW [GLOBAL | SESSION] VARIABLES [like_or_where];
状态(统计)参数/变量:保存MySQL运行过程中的统计数据或状态数据;
mysql> SHOW [GLOBAL | SESSION] STATUS [like_or_where];