大橙子网站建设,新征程启航
为企业提供网站建设、域名注册、服务器等服务
查看某个表的建表语句,可以使用phpmyadmin查看,首先选择这个表所在的数据库,比如:ecshop库,里面有个ecs_goods表,那么查看goods表的建表语句为:
让客户满意是我们工作的目标,不断超越客户的期望值来自于我们对这个行业的热爱。我们立志把好的技术通过有效、简单的方式提供给客户,将通过不懈努力成为客户在信息化领域值得信任、有价值的长期合作伙伴,公司提供的服务项目有:空间域名、网络空间、营销软件、网站建设、双台子网站维护、网站推广。
show create
table ecs_goods
把这条sql语句复制到
点击执行,ok结果就出来了:
把显示的结果复制到其它机器上运行,就建好一张goods表了
call sp_add();
是不是你定义的过程有问题吧,并没有指出返回结果来
像我这样是可以的:
CREATE PROCEDURE sp_add(a int, b int,out c int)
begin
set c=a+ b;
end;
调用过程:
call sp_add (1,2,@a);
select @a;
1先通过status命令查看Mysql运行状态mysqlstatus;--------------mysqlVer14.14Distrib5.1.73,forredhat-linux-gnu(x86_64)usingreadline5.1Connectionid:113752Currentdatabase:information_schemaCurrentuser:push_user@localhostSSL:NotinuseCurrentpager:stdoutUsingoutfile:''Usingdelimiter:;Serverversion:5.1.73SourcedistributionProtocolversion:10Connection:LocalhostviaUNIXsocketServercharacterset:latin1Dbcharacterset:utf8Clientcharacterset:latin1Conn.characterset:latin1UNIXsocket:/tmp/mysql.sockUptime:22days8hours31min23secThreads:38Questions:1037751897Slowqueries:2356Opens:79836Flushtables:1Opentables:64Queriespersecondavg:537.282--------------在上面显示列表的最后一条,我们来查看Slowqueries这一项的值,如果多次查看的值大于0的话,说明有些查询sql命令执行时间过长。2)这时再通过showprocesslist命令来查看当前正在运行的SQL,从中找出运行慢的SQL语句,找到执行慢的语句后,再用explain命令查看这些语句的执行计划。mysqlshowprocesslist;+--------+-----------+---------------------+--------------------+---------+-------+-------+------------------+|Id|User|Host|db|Command|Time|State|Info|+--------+-----------+---------------------+--------------------+---------+-------+-------+------------------+|50270|ambari|DataBase-01:41512|ambari|Sleep|23||NULL||50271|ambari|DataBase-01:41511|ambari|Sleep|6||NULL||50272|ambari|DataBase-01:41514|ambari|Sleep|23||NULL||62452|oozie|DataBase-02:42987|oozie|Sleep|25||NULL||63660|ambari|DataBase-01:56052|ambari|Sleep|0||NULL||110404|push_user|localhost:33817|quartz|Sleep|12||NULL||112835|push_user|localhost:46571|hibernate|Sleep|1||NULL||113163|push_user|localhost:56585|hibernate|Sleep|1||NULL||113289|push_user|14.118.132.20:47333|DW|Sleep|628||NULL||113320|push_user|localhost:47428|hibernate|Sleep|3||NULL||113321|push_user|localhost:47429|hibernate|Sleep|3||NULL||113322|push_user|localhost:47430|hibernate|Sleep|3||NULL||113357|push_user|localhost:52337|hibernate|Sleep|3||NULL||113364|push_user|localhost:57206|hibernate|Sleep|3||NULL||113366|push_user|localhost:34813|hibernate|Sleep|1||NULL||113398|push_user|localhost:37382|hibernate|Sleep|1||NULL||113498|push_user|localhost:47626|quartz|Sleep|12717||NULL||113709|push_user|localhost:59382|hibernate|Sleep|1||NULL||113710|push_user|localhost:33627|hibernate|Sleep|1||NULL||113715|hive|DataBase-02:54968|hive|Sleep|2390||NULL||113716|hive|DataBase-02:54969|hive|Sleep|2390||NULL||113717|hive|DataBase-02:54974|hive|Sleep|2336||NULL||113718|hive|DataBase-02:54975|hive|Sleep|2336||NULL||113719|push_user|localhost:48243|hibernate|Sleep|1||NULL||113720|push_user|localhost:48245|hibernate|Sleep|1||NULL||113721|push_user|localhost:48244|hibernate|Sleep|1||NULL||113722|push_user|localhost:48247|hibernate|Sleep|1||NULL||113723|push_user|localhost:48249|hibernate|Sleep|1||NULL||113724|push_user|localhost:48248|hibernate|Sleep|1||NULL||113745|push_user|localhost:50684|hibernate|Sleep|1||NULL||113746|push_user|localhost:50685|hibernate|Sleep|1||NULL||113747|push_user|localhost:50695|hibernate|Sleep|1||NULL||113748|push_user|localhost:50696|hibernate|Sleep|1||NULL||113749|push_user|localhost:50697|hibernate|Sleep|1||NULL||113750|push_user|localhost:50699|hibernate|Sleep|1||NULL||113751|push_user|localhost:50700|hibernate|Sleep|1||NULL||113752|push_user|localhost|information_schema|Query|0|NULL|showprocesslist||113753|push_user|14.118.132.20:28688|DW|Sleep|396||NULL|+--------+-----------+---------------------+--------------------+---------+-------+-------+------------------+38rowsinset(0.00sec)或者通过如下命令查询:mysqluseinformation_schema;mysqlselect*fromPROCESSLISTwhereinfoisnotnull;+--------+-----------+-----------+--------------------+---------+------+-----------+--------------------------------------------------+|ID|USER|HOST|DB|COMMAND|TIME|STATE|INFO|+--------+-----------+-----------+--------------------+---------+------+-----------+--------------------------------------------------+|113752|push_user|localhost|information_schema|Query|0|executing|select*fromPROCESSLISTwhereinfoisnotnull|+--------+-----------+-----------+--------------------+---------+------+-----------+--------------------------------------------------+1rowinset(0.00sec)
方法一、使用source调用写好的sql文件,例如:
mysql source d:\db\load.sql
方法二、记事本打开sql文件,全选复制之后,粘贴到命令窗口里面(点鼠标右键粘贴)