473,699 Members | 3,123 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Why are databases created in /var/lib/mysql ???

I am a newbie in the world of MySQL. In fact I enabled it in my Linux
box only because it is required to run WordPress (the blogging
software). I was trying to plan ahead and figure out a way to backup
(and restore) a database, should my Linux machine ever goes belly up. I
disovered that the databases are stored in subdirectories under
/var/lib/mysql.

My questions are basically three:

(1) Why /var/lib? Why not some /home/mysql or similar? - where one
expects to find data, not executables or libraries?

(2) Is it possible to configure my installation of MySQL to use some
other path for the databases? (e.g. /home/mysql or
/home/linuxlover/mysql)

(3) Is there an article or doc that outlines a good practice for
backing up - and restoring - a database without relying on a specific
MySQL configuration? Ideally, I would like to be able to copy a
database from one server to another... but if not possible, just
backup/restore to same server is good enough. A URL would be
appreciated.

BTW, I am running MySQL 4.1.14, phpMyAdmin - 2.8.0.4 on Fedora Core 4.

Thanks!
Lynn

Jun 1 '06 #1
5 15400
OK - regarding question #2, using phpMyAdmin I was able to click "Show
MySQL system variables" (left pane) and see that "/var/lib/mysql/" is
stored in a "server variable" named "bdb home".

Is there a way to change it?

If so, how?

Thanks,
Lynn

li************* *@yahoo.com wrote:
I am a newbie in the world of MySQL. In fact I enabled it in my Linux
box only because it is required to run WordPress (the blogging
software). I was trying to plan ahead and figure out a way to backup
(and restore) a database, should my Linux machine ever goes belly up. I
disovered that the databases are stored in subdirectories under
/var/lib/mysql.

My questions are basically three:

(1) Why /var/lib? Why not some /home/mysql or similar? - where one
expects to find data, not executables or libraries?

(2) Is it possible to configure my installation of MySQL to use some
other path for the databases? (e.g. /home/mysql or
/home/linuxlover/mysql)

(3) Is there an article or doc that outlines a good practice for
backing up - and restoring - a database without relying on a specific
MySQL configuration? Ideally, I would like to be able to copy a
database from one server to another... but if not possible, just
backup/restore to same server is good enough. A URL would be
appreciated.

BTW, I am running MySQL 4.1.14, phpMyAdmin - 2.8.0.4 on Fedora Core 4.

Thanks!
Lynn


Jun 1 '06 #2
Oops... I was too quick on the trigger... Actually, there is another
variable that contains the value "/var/lib/mysql/" called "datadir".

I think that "datadir" is the variable I am looking to change.

Is it possible to modify it so that MySQL looks from now on at a new
path?
If so, is it possible to move existing databases to the newly pointed
path?

Thanks,
Lynn

linuxlover992.. .@yahoo.com wrote:
OK - regarding question #2, using phpMyAdmin I was able to click "Show
MySQL system variables" (left pane) and see that "/var/lib/mysql/" is
stored in a "server variable" named "bdb home".

Is there a way to change it?

If so, how?


Jun 1 '06 #3
And the answer is... Yes it is possible.

All needed is:
1. Shudown mysqld daemon (/etc/init.d/mysqld stop)
2. Move /var/lib/mysql/ to /home/mysql/
3. Modify /etc/my.conf so that datadir=/home/mysql
4. Start mysqld daemon (/etc/init.d/mysqld start)

Simple.

However, I decided not to do so - for the sake of simplifying future
updates of Fedora or MySQL. I realized that it is easier to deal with
the arbitrariness of the databases location than with some uknown
future incompatibiliti es when upgrading.

Lynn

li************* *@yahoo.com wrote:
Oops... I was too quick on the trigger... Actually, there is another
variable that contains the value "/var/lib/mysql/" called "datadir".

I think that "datadir" is the variable I am looking to change.

Is it possible to modify it so that MySQL looks from now on at a new
path?
If so, is it possible to move existing databases to the newly pointed
path?


Jun 1 '06 #4
li************* *@yahoo.com wrote:
I realized that it is easier to deal with
the arbitrariness of the databases location than with some uknown
future incompatibiliti es when upgrading.


Good plan. Though it is arbitrary, it is a convention on Linux to use
/var for variable files, like logs, temp files, and databases.

For more information on this convention, see:
http://en.wikipedia.org/wiki/Filesys...archy_Standard

Regards,
Bill K.
Jun 2 '06 #5
>I am a newbie in the world of MySQL. In fact I enabled it in my Linux
box only because it is required to run WordPress (the blogging
software). I was trying to plan ahead and figure out a way to backup
(and restore) a database, should my Linux machine ever goes belly up. I
disovered that the databases are stored in subdirectories under
/var/lib/mysql.

My questions are basically three:

(1) Why /var/lib? Why not some /home/mysql or similar? - where one
expects to find data, not executables or libraries?
FreeBSD puts it in /var/db/mysql. I think /var may be the most
appropriate place for data, depending on how tied to the system
MySQL is. For example, some people use MySQL for login authentication,
so you can't even log in without it, so it better be mounted soon.

/home may, in some installations, be a NFS filesystem and shared
between machines, something which might not be wanted for MySQL.
(2) Is it possible to configure my installation of MySQL to use some
other path for the databases? (e.g. /home/mysql or
/home/linuxlover/mysql)
I believe there are three approaches:

(1) set datadir in /etc/my.cnf, (preferred) or
(2) as a command line option to mysqld (sometimes useful for running
TWO instances of mysqld on the same system with different data
directories and ports), or
(3) Create a symlink /var/lib/mysql that points to whatever directory
you want used.

In all cases you want to move the previous contents of /var/lib/mysql
to the new location first, with the server shut down when you do it.
Be sure to preserve permissions and ownerships. Then restart the server.
(3) Is there an article or doc that outlines a good practice for
backing up - and restoring - a database without relying on a specific
MySQL configuration?
mysqldump is pretty good. It doesn't care about the binary format
of tables in different MySQL versions, or directory locations.
Ideally, I would like to be able to copy a
database from one server to another... but if not possible, just
backup/restore to same server is good enough. A URL would be
appreciated.
mysqldump -h src.hostname.ex ample.com ... | mysql -h dest.hostname.e xample.com ...

run on another host command.hostnam e.example.com (which might be the
same as one of the servers). Options to mysqldump specify what to dump
and whether it's to dump schema, data, or both, and there are some
options for making the output palatable to lower-version servers.

For more information, type "mysqldump --help | more".

The source and destination servers can be the same if you are
careful (e.g. copy database xyz to xyzbackup1 on the same server).

For this to work, you need:
- MySQL servers set up and running on src.hostname.ex ample.com and
dest.hostname.e xample.com.
- MySQL client software set up on command.hostnam e.example.com.
- Login accounts for some user on command.hostnam e.example.com on the
servers src.hostname.ex ample.com and dest.hostname.e xample.com,
with enough privileges to do what you are trying to do.
- Network connectivity between the hosts, including no blocking of
MySQL connections by firewalls.
BTW, I am running MySQL 4.1.14, phpMyAdmin - 2.8.0.4 on Fedora Core 4.


Gordon L. Burditt
Jun 2 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
3258
by: George Augustino | last post by:
REQUEST FOR DISCUSSION (RFD) unmoderated group comp.databases.mysql Newsgroup line: comp.databases.mysql MySQL relational database system discussion group. This is a formal Request For Discussion (RFD) for the creation of a world-wide unmoderated Usenet newsgroup comp.databases.mysql. This is not a Call for Votes (CFV); you cannot vote at this time. Procedural details are below.
7
1829
by: NAN Team | last post by:
Dear Proponent, Your proposal has been accepted and the C.F.V. has been waived. The newsgroup was created for you. As an added bonus, we have also created additional newsgroups in the alt and us hierarchies for you. comp.databases.mysql us.comp.databases.mysql alt.comp.databases.mysql
11
2195
by: Joshua Beall | last post by:
Hi All, I am working on a registration system, and one of the things I am going to need to be able to do it setup the database tables for each event that I have registration for. Normally I would do this by hand, but I am wondering if there are any code libraries out there that could generate the SQL for me. Basically I would have a list of column names and types. I know I could just foreach() through the list, with a switch to...
8
2684
by: William Drew | last post by:
REQUEST FOR DISCUSSION (RFD) unmoderated group comp.databases.mysql This is an invitation to discuss the following proposal to create newsgroup comp.databases.mysql. Please note that YOU CANNOT VOTE NOW; you may be able to vote on a version of this proposal later. See the PROCEDURE section below if you need information about how the discussion works. PLEASE POST ANY FOLLOWUPS TO THE NEWSGROUP NEWS.GROUPS.
2
5046
by: Tim Williams | last post by:
I'm trying to write a simple python program to access a MySQL database. I'm having a problem with using MySQLdb to get the results of a SQL command in a cursor. Sometimes the cursor.execute works, sometimes not. From mysql: mysql> show databases; +-----------+ | Database |
0
1221
by: Kai Li | last post by:
Hi, I know that Mysql handles large database very well, but there is a project that requires more than 2000 small databases(about 20 talbes with a few rows) to be created within a Mysql server. Could somebody tell me does it make sense? Thanks for your consideration. likai _________________________________________________________________
2
3081
by: James Alexander Starritt | last post by:
I also posted similarly in mailing.database.mysql I have created a rather large (60 table database) website dealio in PHP that works with MS SQL Server, Oracle, MySQL and presumably any other data base I add to the wrapper functions that I created. All the development was done in Oracle, but now its time to create that large datastructure again in MySQL -- now I've built this all in notepad for Oracle (twice) and built it in SQL Server...
1
3341
by: com | last post by:
Extreme Web Reports 2005 - Soft30.com The wizard scans the specified MS Access database and records information such as report names, parameters and subqueries. ... www.soft30.com/download-1-11975.htm - 31k - Cached - Similar pages MDBSecure 1.0.8.0 - Soft30.com Utility which makes it easy to create secure MS Access Databases, ... MS Access 2000/2003 format. 30 day money back guarantee, 30 day trial. ...
3
1973
by: John Salerno | last post by:
Hi everyone. I just installed MySQL on my home PC and I tested out the show databases query, and it lists two: information_schema bbdatabank The second one is one I created myself, but I don't understand what the first one is. It is not listed in my 'data' folder, but mysql and test *are*, yet they aren't listed when I type the show command. Why is that? How can I get them listed so that I can use them, and what is the
0
8709
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8638
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9202
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8952
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8909
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6555
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5894
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
3081
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2018
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.