Link to home
Create AccountLog in
Avatar of dba2dba
dba2dba

asked on

Questions on MySQL Concepts

Hello Experts,

I am new to MySQL and was going through the MySQL Concepts. I have few questions. I am working on MySQL 5.x on CentOS 5.7.

1) Does MySQL Server run under the privilege of any particular account
2) I installed it using YUM groupinstall. How is mysql typically installed. is it from YUM or is it from RPM's
3) I have gone through some articles for moving mysql databases to new directories which involves changing the data directory path in my.cnf. Is there a way in MySQL to move only a specific database to a new directory. If yes, how is this handled.

 Appreciate your help.

Thanks,
SOLUTION
Avatar of Hugh McCurdy
Hugh McCurdy
Flag of United States of America image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
ASKER CERTIFIED SOLUTION
Avatar of Dave Baldwin
Dave Baldwin
Flag of United States of America image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
SOLUTION
Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
Avatar of dba2dba
dba2dba

ASKER

Thanks for your responses.

Can you please guide me how to find out under which user the mysql server is running and how to change it to a different user (if at all we can).

Regarding moving the database - If we have a need to move a database XYZ to a different location due to space issues. Can we mount a new drive to the file system and move just the XYZ database leaving all other database in the default /var/lib/mysql database.

These questions arise due to my mssql background  :)

Thanks for your time.
Avatar of dba2dba

ASKER

Thanks for your response xterm. I did not see your post before replying.

As mentioned in my previous post, can you help me find out under which user the mysql server is running and how to change it to a different user (if at all we can).

Thanks,
You can look at who owns the database directory:

[xterm@home mysql]$ ls -ld /var/lib/mysql
drwxr-xr-x. 2 mysql mysql 4096 Jul 12 15:45 /var/lib/mysql

As you can see, user mysql, group mysql.  Also, if you run "top", and then sort by memory (hit capital "M") you can see the user there too.

You can actually use the symlink trick to move an individual database (see below) but MySQL will still think the DB is in /var/lib/mysql


#>  /etc/init.d/mysqld stop
#>  cd /var/lib/mysql
#>  mv dbtomove /other/partition/mysql
#>  ln -s /other/partition/mysql/dbtomove dbtomove
#>  /etc/init.d/mysqld start

Open in new window

"These questions arise due to my mssql background  :) "  I thought so.  Note there are some serious differences between MySQL and MS SQL, number one being the method of locating the files.  Where a MS SQL database is all in one file (plus a log file), MySQL dedicates a directory to a database and puts a bunch of files in it that are for that database.
Avatar of dba2dba

ASKER

I see there are a lot of differences between MSSQL and MySQL. I have got mysql installed on a test machine and is going through it. Thanks to everyone for your time.
One thing I forgot to mention.  Database and table names are used in the file names in MySQL so on Linux, they are case sensitive.