Web Hosting Talk







View Full Version : Setting up a MySQL database...


vito
06-21-2002, 12:54 PM
I am selling a product where my customers have to create a MySQL database on their server.

2 questions:

1. Can a MySQL db be set up on a Windows server as well, or just Linux box?

2. Some customers get scared when you tell them they have to create a db. They don't know how. So I am offering an "installed" price as well. So far, I've only had experience in creating db in cpanel and Plesk. If a customer has neither, is my only other option SSH?

If by SSH, can someone give me the basic commands to create a MySQL database? I just want to know how to create it, name it, and assign it a username/password. Regarding populating it, my product does that automatically through a browser.

Thanks for your help.

Vito

Nadav
06-21-2002, 12:59 PM
1. Yes, mysql can be installed on Windows.
2. Don't have it memorized, i'll see if I can find a manual.

vito
06-21-2002, 01:07 PM
Thanks, Nadav.
So is that to say that there are no server restrictions for setting up a MySQL db? (assuming of course that the web host allows a MySQL)

I look forward to your instructions on setting up a db through SSH (hopefully you can find it).

Thanks again.

Vito

ffeingol
06-21-2002, 01:07 PM
The command to create (via ssh) would be:

mysqladmin -u root -p create database

"database" is the name of the database that you would want to create.

I'm not sure what your product is, but a lot of people will not be able to create their own db's. They will need to ask their host to do it.

Frank

vito
06-21-2002, 01:11 PM
Thanks, Frank.
Do you know how I'd go about creating the username and password?

vito

elsmore1
06-21-2002, 01:16 PM
Originally posted by vito
Thanks, Nadav.
So is that to say that there are no server restrictions for setting up a MySQL db? (assuming of course that the web host allows a MySQL)

Vito

If the web host has configured mysql to allow the mysql user you/your client has access with to create databases, you are set to go. Most hosts (the smart ones anyway) will not have configured mysql to allow users to create databases. There is usually an interface, separate from mysql, which interacts with mysql on the user's behalf to create a limited number of databases. That interface would be host specific, and may be a part of the control panel the host uses. Other hosts may not allow users to create databases at all, but require that you contact them for new databases.

Summary: To set up a database via ssh will require that you have access to a mysql user with permissions to create databases, which would be very uncommon (I hope) in a shared hosting environment. Dedicated servers are a different story.

elsmore1
06-21-2002, 01:25 PM
If you don't know how to create a mysql database and assign user permissions to users/databases, you should probably not be attempting to do it for customers until you have read the mysql documentation thoroughly, especially concentrating on the access control system, and related security issues. Have your customers ask their host to do it, learn how to do it themselves, or hire a competent system administrator knowlegable in mysql to do it.

iamdave
06-22-2002, 12:01 AM
If you have phpMyAdmin, you can give them the database dump, and they can copy and paste that into phpMyAdmin. That takes about 30 seconds.

vito
06-22-2002, 04:16 AM
Thanks for the replies. I am familiar with how to set it up with control panels or phpmyadmin. I guess I'm just looking for the way to do it by SSH. I realize that SSH will not be the most common method, ,but I want to have the procedure in the event I need it.

In Frank's post earlier, he showed the command to create the database. All I really need now is the command to create the user and password.

infinite
06-22-2002, 08:10 AM
You need to run a sql command to add a row into the MySQL database, but you must/should know about the security first. If you can find which table it is, you might be able to work it out, but please read the manual first, a part of it at least, it will help.

HTH,
Infinite :)

vito
06-22-2002, 08:51 AM
But I want to assign a user to the database, not to a table in the db. Then once all files have been uploaded, the customer, using his username/password for access, would point to admin/setup.php in his browser. And this is where the tables would then be created automatically.

There is no easy way to assign a user to a db? In cpanel, I'm able to do that. Why can't I do it in SSH?

elsmore1
06-22-2002, 09:16 AM
If you are allowed (have enough permissions) to add users to databases through ssh (and not through a custom script such as a control panel), you would have enough permissions to add/remove users to any database in the mysql system and also to give or remove permissions from any mysql user on the system. The reasons why this is not a good idea in a shared hosting environment should be obvious, and also make your request a moot point, as there is no need for you to know how to do it if you will not be able to do it anyway.

In a dedicated server environment, if you were given "root" access to mysql, you could of course accomplish the task, but.... creating mysql users, and assigning user permissions is the heart of what the mysql access-control system is all about, and having someone that has no understanding of the access-control system and how to securely create users and assign permissions to those users just going in and doing it is probably a bad idea.

Nobody here is saying you cannot do it, or that you could not do it "safely", just that you should learn how to do it safely before doing it. If you were to study the mysql docs enough to learn how to do it safely, you will also know how to do it. Hence, no need for you to post here asking someone to tell you how to do it, without understanding the security issues involved.

Your customers aren't going to be very happy with you if you set up databases for them, and then later find out that the way you did it allowed some hacker to break into the system and wipe the entire hard drive clean.

Originally posted by vito
But I want to assign a user to the database, not to a table in the db. Then once all files have been uploaded, the customer, using his username/password for access, would point to admin/setup.php in his browser. And this is where the tables would then be created automatically.

There is no easy way to assign a user to a db? In cpanel, I'm able to do that. Why can't I do it in SSH?

vito
06-22-2002, 12:03 PM
I understand. Thank you.