Solved

How to setup MySQL for a virtual site

Posted on 2001-07-31
6
238 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

 
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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Over the last ten+ years I have seen Linux configuration tools come and go. In the early days there was the tried-and-true, all-powerful linuxconf that many thought would remain the one and only Linux configuration tool until the end of times. Well,…
SSH (Secure Shell) - Tips and Tricks As you all know SSH(Secure Shell) is a network protocol, which we use to access/transfer files securely between two networked devices. SSH was actually designed as a replacement for insecure protocols that sen…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

735 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