Solved

How to setup MySQL for a virtual site

Posted on 2001-07-31
6
227 Views
Last Modified: 2013-12-16
Hello,

my problem is as follows, the server admin is on holiday and I havn't got a clue on how to setup up permission for a customer with a virtual site on our server to use MySQL (which is already installed on the server) ...the guy who normally does it said something about writing it into a table????? the system configuration is

Cobalt RaQ 3i
Redhat 5.2?
MySQL newest one?

now this question is fairly straight forward for somebody who does that sort of stuff every day, the reason I class it as hard is that you have to make it understandable to me (with something like no linux knowledge)i.e. please explain it clearly...

many thanks
0
Comment
Question by:dcb2007
  • 4
  • 2
6 Comments
 
LVL 3

Expert Comment

by:superschlonz
ID: 6339095
Before you start you need some informations:
 - name of the database(s) they may use
 - host(s) from where they may connect
 - username(s) and password(s)
 - which privileges should be granted

If you know that it's easy:

GRANT <privileges> ON <database>.* TO <user>@<host>
  [IDENTIFIED BY 'some_pass'] [WITH GRANT OPTION];

Have also a look at the documentation at http://www.mysql.com/documentation/mysql/bychapter/ (chapter 3).

Give us some more information what exactly you have to do (create database, create user or just change priviledges).
0
 

Author Comment

by:dcb2007
ID: 6339449
well, the customer who got a virtual host on our server wants to be able to use MySQL for their website...the host they can connect from? shouldn't that be in this case local only i.e. he can only use the SQL with the webspace he got from us? or is it standard to allow them to connect from anywhere? do I need to create a database for each virtual site? because we got the mysql running for a couple of virtual hosts? username and password? I can just use the same as for the webspace they got right?....hmmm which privileges should be granted...no idea...basically that the customer can use mysql on his/her site in together with PHP (which is running for all sites)

if I know that its easy...well as I said, I dont know anything about linux or mysql i.e. what do I do? do I just go login as root and type in that "grant command"...by the way the admin gave me a password for mysql, where does that come in...?
0
 
LVL 3

Expert Comment

by:superschlonz
ID: 6343655
> well, the customer who got a virtual host on our server
> wants to be able to use MySQL for their website...the
> host they can connect from? shouldn't that be in this
> case local only i.e. he can only use the SQL with
> the webspace he got from us?
OK, then the host is localhost.

> or is it standard to allow them to connect from anywhere?
That could be a security problem. There are two possibilities:
1. You allow it, the customer will then be able to create the needed tables and insert data which is needed.
2. you don't allow it, but then you will have to create tables etc. or the customer can login via ssh.
You could try to find out how it is configured for other customers.

> do I need to create a database for each virtual site? because we got
> the mysql running for a couple of virtual hosts?
I think normally every customer has it's own database. It's  easyer for administration.

> username and password? I can just use the same as for the  webspace they got right?
Yes.

> ....hmmm which privileges should be granted...no idea...basically that the customer
> can use mysql on his/her site in together with PHP (which is running for all sites)
If the customer has its own database you can give him all privileges for his database.
0
Complete Microsoft Windows PC® & Mac Backup

Backup and recovery solutions to protect all your PCs & Mac– on-premises or in remote locations. Acronis backs up entire PC or Mac with patented reliable disk imaging technology and you will be able to restore workstations to a new, dissimilar hardware in minutes.

 
LVL 3

Expert Comment

by:superschlonz
ID: 6343780
Now the commands you need:

Login to the machine and start mysql (you need the root password of mysql):

mysql -p -u root

Select the mysql database (the one with the user table):

use mysql;

Look which databases exist:

select * from db;

Look which users exist and which privileges they have:

select * from user;

Create a database (replace db_name by customername, have also a look at the documentation 4.1.5  'Database, Table, Index, Column, and Alias Names'):

CREATE DATABASE db_name;

Now create a user and give him access to the database:

GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP ON db_name.* TO username@localhost IDENTIFIED BY 'password';

You have to look if the other users also have CREATE and DROP privileges and perhaps have remote administration privileges (an entry where the host is not localhost).
0
 

Author Comment

by:dcb2007
ID: 6350022
many thanks for your answer, I solved the problem in another way i.e. I cheated a bit - I installed webmin and after I set the sql dir. it was all quite easy from there...but now I got another problem the customer can see the other databases on the server (from other customers) he has of course not the right to do anything to them but he can see them using phpmyadmin? is that always like that? for the hosts from which it should be accessable I put localhost?
0
 
LVL 3

Accepted Solution

by:
superschlonz earned 200 total points
ID: 6351716
Does myadmin also ask for username and password (can't remember, is too long since I used it) ?

If yes and the customer can see all the databases I think you have to remove some of the rights he has.
Search for rights which have *.* instead of database.*
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Daily system administration tasks often require administrators to connect remote systems. But allowing these remote systems to accept passwords makes these systems vulnerable to the risk of brute-force password guessing attacks. Furthermore there ar…
The purpose of this article is to demonstrate how we can use conditional statements using Python.
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now