0

I'm very new to SQL and databases. I'm currently following this tutorial for creating a Magento website: https://www.tutorialspoint.com/magento/magento_installation.htm

and I'm on Step 4. It says to create a new database for my site (which I'm running on localhost/magento right now). I downloaded MySQLWorkbench for this, and when I click "Create new connection", I put localhost/magento into the "hostname" section.

I'm just not sure how I'm supposed to create a database for my specific website, and if it needs to be connected to the URL.

Hope somebody can help me out in simple terms :) Thanks.

1

A schema and a connection are two different things. So, creating a new connection does not mean to create a new schema/database.

You can create a database (or schema) in your server by using MySQL Workbench. After you opened a connection to your server, you will see the SQL IDE, a page with the treeview containing your current schemas, an SQL editor and various other stuff. In the schema tree use the context menu on any node to create the schema:

enter image description here

After that you can create a user with only the necessary rights for that single schema. Use the Administration -> Users and Privileges section for that:

enter image description here

Then assign the user access rights (e.g. for SELECT + DELETE) for that new schema by first allowing access to that new schema:

enter image description here

and finally set the required privileges:

enter image description here

Note: the backslash in the priv list is an escape sequence, because the string there is used as a pattern and the underscore ('_') is used as a placeholder in MySQL. Hence it must be escape to be used literally.

  • so when creating the new schema, it asks me for a connection. What exactly is that and how does it relate to my server and schema? I couldn't get past that step – user184434 Jul 1 at 7:57
  • Do you create the schema exactly like I have shown? I don't understand where this query for a connection comes from. You are already in a connection when you create the schema. – Mike Lischke Jul 1 at 11:19
  • "After you opened a connection to your server," <- I haven't done this before, so I'm a little confused about what I'm supposed to put here. It asks for hostname and port, but my website right now is just on localhost/magento – user184434 Jul 1 at 16:52
0

Nope, when you "create a database", think of it like you are creating a folder or a directory.

So, you'd create one with any name you want. Ex: my_fun_db or magneto_db, etc.

You will eventually then create a user who has access to THAT database.
Ex: magneto_user / passwordxyz

And you'd assign that user to have full access to your magneto database.

  • then what should I choose for the Connection and Hostname/port when creating a new database? I don't know what Connections mean and the hostname is defaulted to 127.0.0.1 – user184434 Jul 1 at 5:09

Not the answer you're looking for? Browse other questions tagged or ask your own question.