定制你的MySQL命令行
我在登录MySQL后的命令行是这个样子的:
warmbupt@pchuang:/windows/MyCode/SS$ mysql -u root -ppassw0rd
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 37
Server version: 5.1.37-1ubuntu5.1 (Ubuntu)
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
通过一系列改造,我们可以得到一个更加user-friendly的命令行提示符。
我们试着显示用户名、主机名和正在使用的数据库名称:
在shell命令行中设置环境变量:
export MYSQL_PS1="\u@\h [\d]> "
其中
\u – Username 用户名
\h – Hostname 主机名
\d – Current mysql database 当前数据库
当然,你可以将该命令写入bashrc以后在bash下使用都能得到这样的命令行提示符了。或者你可以在MySQL的配置文件/etc/my.cnf 或.my.cnf设置:
prompt=\\u@\\h [\\d]>\\_
另外,你在MySQL内也可以设置:
prompt \u@\h [\d]>
在你想回归原始的时候你可以在MySQL中键入prompt即可回归(回到在MySQL外部的设置,若你在bashrc中写入的话即回归到bashrc中的设置状态)。
附变量表:
Generic variables:
\S displays semicolon
\’ displays single quote
\” displays double quote
\v displays server version
\p displays port
\\ displays backslash
\n displays newline
\t displays tab
\ displays space (there is a space after \ )
\d displays default database
\h displays default host
\_ displays space (there is a underscore after \ )
\c displays a mysql statement counter. keeps increasing as you type commands.
\u displays username
\U displays username@hostname accountname
Date related variables:
\D displays full current date (as shown in the above example)
\w displays 3 letter day of the week (e.g. Mon)
\y displays the two digit year
\Y displays the four digit year
\o displays month in number
\O displays 3 letter month (e.g. Jan)
\R displays current time in 24 HR format
\r displays current time in 12 hour format
\m displays the minutes
\s displays the seconds
\P displays AM or PM
相关文档:
大部分服务器管理员知道MySQL数据库管理系统(RDBMS)是高度灵活的软件块,带有范围广阔的启动选项,可以用来修改相关行为。然而,大部分人却不
清楚,标准MySQL客户端带有同等大量的启动选项,其中一些在日常MySQL交互作用中极为有用。这些选项本身不是
“秘密”,而它们中很多未被使用,甚至其中一些可以显著 ......
我的测试环境.基本上数据是瞬间同步,希望对大家有帮助
redhat 9.0
mysql3.23.57
mysql数据同步备份
A服务器: 192.168.1.2 主服务器master
B服务器: 192.168.1.3 副服务器slave
A服务器设置
#mysql –u root –p
mysql>GRANT FILE ON *.* TO backup@192.168.1 ......
1.install mysql
get mysql
http://ftp.iij.ad.jp/pub/db/mysql/Downloads/MySQL-5.1/mysql-5.1.41-linux-i686-icc-glibc23.tar.gz
[root@localhost mysql]# tar -zxvf mysql-5.1.41-linux-i686-icc-glibc23.tar.gz
[root@localhost mysql]# cd mysql-5.1.41-linux-i686-icc-glibc23
[root@localhost mysql]# vim RE ......
how to install apache, PHP and MySQL on Linux
This tutorial explains the installation of Apache web server, bundled
with PHP and MySQL server on a Linux machine. The tutorial is primarily for SuSE
9.2, 9.3, 10.0 & 10.1, but most of the steps ought to be valid for all
Linux-like operating ......
今天找到了取mysql表和字段注释的语句
取字段注释
SELECT COLUMN_NAME 列名, DATA_TYPE 字段类型, COLUMN_COMMENT 字段注释
from INFORMATION_SCHEMA.COLUMNS
WHERE table_name = 'companies'##表名
AND table_schema = 'testhuicard'##数据库名
AND column_name LIKE 'c_name'##字段名
--------------------------- ......