Connecting to Local MySQL and Remote MySQL in PHP

  Рет қаралды 13,910

Christian Hur

Christian Hur

2 жыл бұрын

⭕ Overview
Hello, this is Christian. In this video, I will show you how to work with PHP and connect to both local and remote database systems. We'll use PHPStorm to manage our projects and databases.
First, I'll show you my local project setup in PHPStorm, connected to a local database and a remote server using FTP. The remote server is hosted on Prometheus. Both the local and remote databases have identical structures and data, ensuring consistency across environments.
We begin by exploring the database connections in PHPStorm. You'll see two connections: one to the local database and one to the remote database. Both databases contain the same tables and data, which I'll demonstrate by opening and comparing the content.
Working locally allows you to develop and test your applications without affecting the live server. Once you're satisfied with your local changes, you can transfer your files to the remote server. It's crucial to ensure that your local and remote databases are in sync to avoid discrepancies.
Next, I'll explain the connection methods to these databases. For local connections, the IP address is typically `127.0.0.1` or `localhost`. For remote connections, you'll use the server's IP address or hostname provided by your hosting service.
By following this setup, you'll be able to develop and maintain your PHP applications efficiently, leveraging both local and remote databases for a seamless development workflow.
If you find this video helpful, please give it a thumbs up, share it with your friends, and subscribe to my channel for more tutorials and insights into programming. Your support helps me create more content to assist you in your learning journey. Thank you for watching!
Diagram: docs.google.com/drawings/d/1Y...
⭕ Chapters
0:00 - Introduction
⭕ About me
I am a Web Instructor at Gateway Technical College, an Adjunct Professor at Boston University Metropolitan College, Web Instructor at University of California, Irvine - Division of Continuing Education.
⭕ Visit my site: christianhur.com
⭕ My complete online training courses:
☑️ REST APIs & AJAX Operations Using Node, Express, and jQuery: www.udemy.com/course/rest-api...
☑️ Build Clean and Secure PHP Web Apps From Scratch: www.udemy.com/course/build-cl...
☑️ Angular 9 New Features: www.packtpub.com/web-developm...
☑️ Full-Stack Web Development with Flask: www.packtpub.com/web-developm...
☑️ Full-Stack Web Development with Django & Angular 8: www.packtpub.com/web-developm...
☑️ Angular 7 New Features: www.packtpub.com/web-developm...
☑️ The DOM in JavaScript, jQuery, AngularJS, and React : / the-dom-in-javascript-...
☑️ Building JSF Web Applications with Java EE 7: / building-jsf-web-appli...
☑️ Troubleshooting Vue.js: www.packtpub.com/application-...
⭕ Check out my book:
Developing Business Applications for the Web: With HTML, CSS, JSP, PHP, ASP.NET, and JavaScript is available on Amazon and MC Press.
☑️ Link: www.mc-store.com/collections/...

Пікірлер: 13
@lovietech3885
@lovietech3885 Жыл бұрын
Wow! thank you so much for this great information, its really helpful to me, thanks for making it well explanatory and not hiding a single information on the video and not also assuming that we already understand something and you omitting it. What I just got from your video is the last dot that I need to connect all other information I've gather and solve my problem and it really does. Thank you once again Useful part of the information for me =============================== 1. Use base url of the remote database instead of the server IP 2. Connect over VPN 3. I have to add my IP which is the vpn IP to the Remote MySQL on cPanel to make it work
@ChristianHur
@ChristianHur Жыл бұрын
You're too kind. I am glad to hear it. Thank you for your kind words. All the best and good luck! :)
@itsallaboutdigital8134
@itsallaboutdigital8134 Жыл бұрын
@@ChristianHur 🙏🙏🙏
@henrypandales
@henrypandales Жыл бұрын
Excellent
@ChristianHur
@ChristianHur Жыл бұрын
Thank you for watching and I appreciate the comment. All the best.
@AajAapkokyaSunaaye
@AajAapkokyaSunaaye 2 жыл бұрын
nice video. I have a doubt sir. Once I transfer my website from local to live server... is it possible further to continue writing articles in local and transfer to live as n when articles are produced by the writer. ? this is just to upload "perfect" articles on internet ( live server). pl comment thanks a lot
@ChristianHur
@ChristianHur 2 жыл бұрын
Hi Aaj. When you said "articles in local", are you referring to articles/content stored in a local DB or are you referring to physical PHP files? I am not sure I understood your question correctly, but I don't see how that's not possible. The only issue with a local file or DB and remote one is synchronization. It's probably not a good idea to update a live server DB without taking some precaution (live synchronization & ACID) to prevent overwriting data.
@AajAapkokyaSunaaye
@AajAapkokyaSunaaye 2 жыл бұрын
@@ChristianHur thanks. I am referring to the files in local data base ( stored in phpmyadmin). I thought the practice of rehersal of articles in the local server can be a good idea before transferring them to live server, at least initially wherein your website would be already transferred.
@hussainfaizy8071
@hussainfaizy8071 Жыл бұрын
Thank you sir , this is nice video that help my clients probem but few question : How to use vpn ? We have to write 3 connections in localhost , db , and remote or specific connectin in each of them ? thank you.
@ChristianHur
@ChristianHur Жыл бұрын
You’re welcome. I’m not sure if I understand you correctly, but you don’t need separate VPN (if that’s what you mean) unless you’re pulling data from a different network.
@hussainfaizy8071
@hussainfaizy8071 Жыл бұрын
@@ChristianHur thank you sir I mean that how to sync localphpmyadmin db with life server db(goddady ,hostinger ,blue host .....) ?
@hafizimranattari
@hafizimranattari Жыл бұрын
how to connect in node js with remote mysql
@ChristianHur
@ChristianHur Жыл бұрын
Thanks for watching and the suggestion. All the best.
Quick Overview of Laravel 9 (Ep. 1)
16:37
Christian Hur
Рет қаралды 336
PHP MySQL connect to remote database (Connect Server Database from Localhost)
8:01
Little girl's dream of a giant teddy bear is about to come true #shorts
00:32
Женская драка в Кызылорде
00:53
AIRAN
Рет қаралды 511 М.
Я обещал подарить ему самокат!
01:00
Vlad Samokatchik
Рет қаралды 9 МЛН
Can A Seed Grow In Your Nose? 🤔
00:33
Zack D. Films
Рет қаралды 24 МЛН
Roadmap on how to become a Data Analyst in 2024
11:36
Ashwani Panwar
Рет қаралды 15 М.
How to Set Up MySQL Database with Docker
16:46
Abstract programmer
Рет қаралды 39 М.
C# - Connect To Cpanel MySql Database Remotely In C#
19:39
ProgrammingKnowledge
Рет қаралды 96 М.
What is a REST API?
9:12
IBM Technology
Рет қаралды 1,5 МЛН
Little girl's dream of a giant teddy bear is about to come true #shorts
00:32