将PHP与MY SQL连接起来 [英] Connecting PHP with MY SQL

查看:227
本文介绍了将PHP与MY SQL连接起来的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好我正在尝试使用php和我的Sql进行crud操作





我正在使用 IIS 来运行php文件php文件工作正常,但我无法用MYSQL进行crud操作



我正在使用 MYSQL Workbench 8.0



我尝试过:



Hi I am trying crud operation with php and MY Sql


I am using IIS to run php file php file is working good but i am unable to do crud operation with MYSQL

I am using MYSQL Workbench 8.0

What I have tried:

<?php
$servername = "localhost";
$username = "root";
$password = "Pass@123";

// Create connection
$conn = mysqli_connect($servername, $username, $password);

// Check connection
if (!$conn) {
    die("Connection failed: " . mysqli_connect_error());
}
echo "Connected successfully";
?>





错误信息





Error message

Connection failed: The server requested authentication method unknown to the client

推荐答案

servername =localhost;
servername = "localhost";


username =root;
username = "root";


password =Pass @ 123;

//创建连接
password = "Pass@123"; // Create connection


这篇关于将PHP与MY SQL连接起来的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆