Jump to content

How to setup SQL Database


LT.Steiner

Recommended Posts

There are many types of SQL. What type of SQL are you looking for?

Also, is this for development or a live server? If its for development, and assuming you're on Windows, the most popular one MySQL can be easily installed along with a database editor called phpMyAdmin by installing a local webserver package such as XAMPP (which has MariaDB and not MySQL, they are very similar and drop-in replacements for each other), or my personal favorite EasyPHP

If you read the documentation for whichever webserver package you choose to use you will learn the default username (usually root), and password (usually empty), and you can connect to your web root by going to http://localhost/ or http://127.0.0.1/ where you will be able to access phpMyAdmin and create/edit the structure of your database. (Note, sometimes Windows devserver packages run on port :8080 or something other than :80, which you will need to note from the configuration if you find you can't connect with localhost or 127.0.0.1)

Once the MySQL server is running with your web server package you can connect to it from within your server scripts by doing something similar to this (JS)

var mysql = require("mysql");

var connection  = mysql.createConnection({
  host          : "localhost",
  user          : "root",
  password      : "",
  database      : "database_name"
});

connection.connect(function(err) {
  if (err) throw err;
  console.log("Connected!");
});

Note: This is how I do it, you could also opt for a less bloat option of installing the MySQL server directly from https://dev.mysql.com/downloads/mysql/ but you would need to download a MySQL client from the internet and use that, rather than phpMyAdmin, to create/edit your database.

Edited by Section80
Link to comment
Share on other sites

  • 10 months later...
Am 15.8.2020 um 00:20 schrieb Section80:

There are many types of SQL. What type of SQL are you looking for?

Also, is this for development or a live server? If its for development, and assuming you're on Windows, the most popular one MySQL can be easily installed along with a database editor called phpMyAdmin by installing a local webserver package such as XAMPP (which has MariaDB and not MySQL, they are very similar and drop-in replacements for each other), or my personal favorite EasyPHP

If you read the documentation for whichever webserver package you choose to use you will learn the default username (usually root), and password (usually empty), and you can connect to your web root by going to http://localhost/ or http://127.0.0.1/ where you will be able to access phpMyAdmin and create/edit the structure of your database. (Note, sometimes Windows devserver packages run on port :8080 or something other than :80, which you will need to note from the configuration if you find you can't connect with localhost or 127.0.0.1)

Once the MySQL server is running with your web server package you can connect to it from within your server scripts by doing something similar to this (JS)

var mysql = require("mysql");

var connection  = mysql.createConnection({
  host          : "localhost",
  user          : "root",
  password      : "",
  database      : "database_name"
});

connection.connect(function(err) {
  if (err) throw err;
  console.log("Connected!");
});

Note: This is how I do it, you could also opt for a less bloat option of installing the MySQL server directly from https://dev.mysql.com/downloads/mysql/ but you would need to download a MySQL client from the internet and use that, rather than phpMyAdmin, to create/edit your database.

Thanks Bro, i doesn't know how i could connect my database with my localhost.

All i had found was in C# but now this is a very good explanation.

 

Thanks

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...