您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

source 命令无法使用?

2024/3/24 12:08:18发布18次查看
无法导入???
you have an error in your sql syntax; check the manual that corresponds to your mariadb server version for the right syntax to use near 'source d:\server\three\public\export.sql' at line 1

function importdb($dbh) { $sql = 'source '.realpath('export.sql'); try { $stmt = $dbh->prepare($sql); var_dump($stmt->execute()); var_dump($stmt->errorinfo()); } catch (pdoexception $e) { print $e->getmessage(); }}

注:导入包没问题:
回复内容: 无法导入???
you have an error in your sql syntax; check the manual that corresponds to your mariadb server version for the right syntax to use near 'source d:\server\three\public\export.sql' at line 1

function importdb($dbh) { $sql = 'source '.realpath('export.sql'); try { $stmt = $dbh->prepare($sql); var_dump($stmt->execute()); var_dump($stmt->errorinfo()); } catch (pdoexception $e) { print $e->getmessage(); }}

注:导入包没问题:
execute()只能执行sql语句,而source虽然也能在mysqlclient中执行,但是并不是sql语句,所以d会执行失败,建议直接用php的exec命令进行执行
导入前的先use一下哪个库吧,我用cmd都需要把路径的斜线换成反斜线要不会报错,希望对你有帮助
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product