Home > Database > Mysql Tutorial > Linux中Shell操作MySQL

Linux中Shell操作MySQL

WBOY
Release: 2016-06-07 16:52:05
Original
1202 people have browsed it

#shell mysql****************************************#!/bin/basholname=erik ##旧值,也就是要替换掉的值nwname=erik ##新值,

#shell mysql

****************************************

#!/bin/bash

olname=erik ##旧值,也就是要替换掉的值

nwname=erik ##新值,也就是要替换为的值

domain=@set-china.net ##后缀,此处是用来操作邮件的,,其它用途可以不要或替换成其它

mysql -u root -p password

##操作数据库的开始,此处输入用户名及密码,

##

use extmail;

show tables;

update alias set goto=REPLACE(goto,'$olname','$nwname$domain');

EOF

exit 0;

****************************************

##语句少的情况下可以如下使用

#!/bin/bash

mysql -u root -p password -e "use mysql;select * from user(SQL语句)";

exit 0;

****************************************

linux

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template