Do you have to install MySQL to use it?

Hi, this might be a simple question but I really need some clarification.

I have been learning javascript and now I am starting to learn node.js togheter with MySQL.

I have watch a lot of tutorials telling that you have to download and install MySQL on mac or windows. They also tells you to download MySQL workbench…

But I can create unlimited MariaDB databases on my hosting (which is almost exactly the same as MySQL). Do I then still have to download MySQL workbench or MySQL on my computer, or can I just install mysql driver with npm and use the database on my hosting?

So my question is:

  1. What do I need to install to use my database on my hosting (MariaDB or MySQL)?

Ive never used SQL with nodejs. But I have done with PHP.
I think you have to install MariaDB and u can also install PhpMyAdmin to view/edit your database.

Hi, but do I have to download it on my computer? Because I already got PhpMyAdmin on my hosting account.

If you have PHPMyAdmin on your hosting account, odds are you have mySQL (or Maria, in your case) set up on your hosting account as well.

You don’t need it on your local machine, unless you’re using it as a back-end development environment. If you are hosting your node projects on your local machine, then they will likely need local db access. If you are hosting them through your hosting company, then the phpMyAdmin and MariaDB you have there should usually suffice.

I am hosting my .js files on my computer locally and I was thinking I could from them connect to the database on my hosting account. Is that a bad idea?

Why do they need local db access when I have an online access?

1 Like

In theory, you can. It isn’t as simple as BOOP! I’m connected!, but it shouldn’t be a horrifying ordeal. Take a look at https://mariadb.com/kb/en/library/getting-started-with-the-nodejs-connector/

You’d want to change the host line to point to your hosted MariaDB instance.

And often, it’s considered easier to have a complete local development environment: from node to database to whatever. The advantage to that is, if you are somewhere that you don’t have internet access, you can continue to develop and test your app, then when both the node and the database are ready and stable, you can deploy both.

There’s nothing wrong with using a remote db for development, just… you’ll have to keep track. One more moving part.

ok, thanks a lot for clarifying this!

1 Like