Solved

How to setup MySQL for a virtual site

Posted on 2001-07-31
6
242 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
Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

 
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: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

Title # Comments Views Activity
RHEL 6.7 Gnome Desktop on VMware 6 VM 9 142
SMTP log file for IMSVA 5 75
Shrink Linux Swap File Size CentOS 10 73
MySql Linux vs Windows: bad results for Windows but why? 10 74
I am a long time windows user and for me it is normal to have spaces in directory and file names. Changing to Linux I found myself frustrated when I moved my windows data over to my new Linux computer. The problem occurs when at the command line.…
In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
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…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

759 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