方法一 进入命令行
mysql –u用户名 –p密码 –D数据库【sql脚本文件路径全名】,示例:
注意:
如果在sql脚本文件中使用了use 数据库,则-D数据库选项可以忽略
方法二 进入mysql的控制台后,使用source命令执行
Mysqlsource 【sql脚本文件的路径全名】 或 Mysql\. 【sql脚本文件的路径全名】,示例:
source /home/zj/create_table.sql
使用source命令执行sql脚本.
进入mysql的控制台后,使用source命令执行
Mysqlsource
【sql脚本文件的路径全名】
具体步骤:
假设运行sql脚本是hello.sql,在控制台下输入:
mysqlsource
c:\hello
world\hello.sql(注意路径不用加引号)
或者
\.
world\hello.sql
然后回车即可
你的问题太泛泛了,"MYSQL的程序"你指的是什么?是MYSQL的 存储过程?您最好是具体问题具体问,你这样提问的话大家都不知道你想要什么!
CREATE database name ;
use name;
CREATE TABLE a (
user_id int(11) DEFAULT NULL,
name char(11) DEFAULT NULL,
UNIQUE KEY USER_ID (user_id)
);
CREATE TABLE b (
DELIMITER $$
DROP PROCEDURE IF EXISTS qq$$
CREATE PROCEDURE qq()
begin
declare cursor_flag int default 0;
declare user_nrb cursor for select user_id,name from a;
open user_nrb;
repeat
fetch user_nrb into p_user_id,p_name;
if not cursor_flag then
if not exists (select * from b where user_id=p_user_id) then
insert into b(user_id,name)values(p_user_id,p_name);
else
update b set name=p_name where user_id=p_user_id;
end if;
until cursor_flag end repeat;
close user_nrb;
end$$
DELIMITER ;
以上就是土嘎嘎小编为大家整理的mysql控制台怎么执行相关主题介绍,如果您觉得小编更新的文章只要能对粉丝们有用,就是我们最大的鼓励和动力,不要忘记讲本站分享给您身边的朋友哦!!