donglu5047 2012-04-01 17:16
浏览 28
已采纳

mySQL和Php网站之间的连接如何工作?

I have successfully setup a localhost (Individual Installs) with Apache 2.2, MySQL and PHP, as well as setup a couple virtual-hosts. Currently, I am trying to teach myself command line in MySQL. The part I am lost on is setting up the connection between the database that I create and the virtual-host website I am working on. In my mind I would want to save the database for a specific website in the same folder that I am creating the website. However, I could be way off base. Could some body explain how this piece of the puzzle and how it works. I tried to Google it and all I get is information regarding Work Bench and phpMyAdmin.

  • 写回答

3条回答 默认 最新

  • doudiewen9435 2012-04-01 17:20
    关注

    The MySQL server runs as a service (or daemon) on your server - so the folder (or directory) you put it in is set by the system configuration and has nothing to do with your document root for your web site.

    In PHP, you will "connect" to the MySQL service using PDO or something similar and then send requests to the MySQL server using PHP commands.

    When you are running the MySQL command line interpreter, you can also test those same commands by typing them yourself. This is helpful when you're debugging your PHP program so you can see the data that your program will get yourself in the command line interface.

    I hope this helps put you in the right picture.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料