代码执行错误

代码执行错误

$mysqli=new mysqli("localhost","root","","test4");
var_dump($mysqli);

Warning: Unterminated comment starting line 16 in D:\phpStudy\WWW\MYSQL2\1.php on line 16

Warning: mysqli::__construct(): (HY000/1045): Access denied for user 'root'@'localhost' (using password: NO) in D:\phpStudy\WWW\MYSQL2\1.php on line 12

Warning: var_dump(): Property access is not allowed yet in D:\phpStudy\WWW\MYSQL2\1.php on line 13

Warning: var_dump(): Property access is not allowed yet in D:\phpStudy\WWW\MYSQL2\1.php on line 13

Warning: var_dump(): Couldn't fetch mysqli in D:\phpStudy\WWW\MYSQL2\1.php on line 13

Warning: var_dump(): Couldn't fetch mysqli in D:\phpStudy\WWW\MYSQL2\1.php on line 13

Warning: var_dump(): Property access is not allowed yet in D:\phpStudy\WWW\MYSQL2\1.php on line 13

Warning: var_dump(): Couldn't fetch mysqli in D:\phpStudy\WWW\MYSQL2\1.php on line 13

Warning: var_dump(): Couldn't fetch mysqli in D:\phpStudy\WWW\MYSQL2\1.php on line 13

Warning: var_dump(): Couldn't fetch mysqli in D:\phpStudy\WWW\MYSQL2\1.php on line 13

Warning: var_dump(): Couldn't fetch mysqli in D:\phpStudy\WWW\MYSQL2\1.php on line 13

Warning: var_dump(): Couldn't fetch mysqli in D:\phpStudy\WWW\MYSQL2\1.php on line 13

Warning: var_dump(): Couldn't fetch mysqli in D:\phpStudy\WWW\MYSQL2\1.php on line 13

Warning: var_dump(): Property access is not allowed yet in D:\phpStudy\WWW\MYSQL2\1.php on line 13

Warning: var_dump(): Couldn't fetch mysqli in D:\phpStudy\WWW\MYSQL2\1.php on line 13

Warning: var_dump(): Couldn't fetch mysqli in D:\phpStudy\WWW\MYSQL2\1.php on line 13

Warning: var_dump(): Couldn't fetch mysqli in D:\phpStudy\WWW\MYSQL2\1.php on line 13

Warning: var_dump(): Couldn't fetch mysqli in D:\phpStudy\WWW\MYSQL2\1.php on line 13
object(mysqli)#1 (19) { ["affected_rows"]=> NULL ["client_info"]=> NULL ["client_version"]=> int(50012) ["connect_errno"]=> int(1045) ["connect_error"]=> string(62) "Access denied for user 'root'@'localhost' (using password: NO)" ["errno"]=> NULL ["error"]=> NULL ["error_list"]=> NULL ["field_count"]=> NULL ["host_info"]=> NULL ["info"]=> NULL ["insert_id"]=> NULL ["server_info"]=> NULL ["server_version"]=> NULL ["stat"]=> NULL ["sqlstate"]=> NULL ["protocol_version"]=> NULL ["thread_id"]=> NULL ["warning_count"]=> NULL }

D:\phpStudy>mysql -uroot -p

Enter password: ******

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 3

Server version: 5.5.53 MySQL Community Server (GPL)


Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.


Oracle is a registered trademark of Oracle Corporation and/or its

affiliates. Other names may be trademarks of their respective

owners.


Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.


mysql> use test4;

Database changed

mysql>

数据库也打开了 还是不行

望解决


正在回答 回答被采纳积分+1

登陆购买课程后可参与讨论,去登陆

1回答
好帮手慕查理 2019-08-02 15:24:24

您好,代码中的密码错误。根据同学的反馈,在cmd下是输入了密码的,但是$mysqli=new mysqli("localhost","root","","test4");语句中密码是写的空。请填入密码。

另外报错提示16行有错误,请检查下代码16行。

祝学习愉快!

  • 提问者 慕标5156652 #1
    可以了 谢谢老师
    2019-08-02 15:26:04
问题已解决,确定采纳
还有疑问,暂不采纳

恭喜解决一个难题,获得1积分~

来为老师/同学的回答评分吧

0 星
请稍等 ...
意见反馈 帮助中心 APP下载
官方微信

在线咨询

领取优惠

免费试听

领取大纲

扫描二维码,添加
你的专属老师