ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I'm relatively new at databases so if this is a stupid question I apologize.
Here is my setup:
I have 2 hard drives on my Redhat 9.0 box. The primary drive is a 60GB which I use as the 'main' OS drive which contains '/'. The second drive is a 200GB drive which I mount as '/data'.
My goal is to install a binary copy of MySQL on the 60GB under '/usr/local/mysql' as per the MySQL manual. However, because of the size of the database I'm working with, I need to store the database on the 200GB drive.
My question is this: Is there a way to tell MySQL to use the database located on the 200GB drive?
I haven't tried it but I guess it should be possible either by chaning the datadir in your my.cnf, compiling it with that dir as the default (but you aren't compiling so...) or invoking mysql with the --datadir=/data parameter
I guess you'll have to make sure the access permissions are set up right for /data too.
Someone must have set it up like that but you might aswell try it.
Okay the good news first: I got this to work on Redhat.
The bad news is that my boss just switched to slackware so I have to do this all over again.
ARRRRGGGG!!!
Now here are the steps I took:
I downloaded the compiled binary for linux from mysql.com and typed the following commands:
groupadd mysql
useradd -q mysql mysql
tar -xzvf mysql-*.tar.gz
mv mysql-* /usr/local
cd /usr/local
ln -s /usr/local/mysql-* mysql
cd mysql
scripts/mysql_install_db
chown -R root .
chown -R mysql data
chgrp -R mysql .
chown -R mysql /data
chgrp -R mysql /data
vi /etc/my.cnf
## contents of my.cnf ##
[mysqld]
datadir=/data ##200GB maxtor drive where I want to store the databases
socket=/tmp/mysql.sock
port=3306
user=mysql
## end my.cnf ##
cp support-files/mysql-server /etc/rc.d/rc.mysqld
vi /etc/rc.d/rc.mysqld
## changed the default datadir to be /data ##
datadir=/data
## end changes to /etc/rc.d/rc.mysqld ##
./bin/mysqld_safe --users=mysql &
Now this starts and then quits with no errors. I look at the linuxbox.err file that is created in /data and this is what it contains:
031206 18:08:00 mysqld started
Warning: Ignoring user change to 'mysql' because the user was set to 'mysql' earlier on the command line
031206 18:08:01 InnoDB: Started
031206 18:08:01 Fatal error: Can't open privilege tables: Can't find file: './mysql/host.frm' (errno: 13)
031206 18:08:01 Aborting
This happens every time and I can't figure out why! The file it's complaining about is in the mysql folder created by mysql_install_db script. If I change all the 'datadir=' enteries to point to /usr/local/mysql/data everything works.
So 2 questions:
1 what is going on?
2 Can I some how fix this so that the default data directory is /data and not /usr/local/mysql/data
I think i have the solution to your problem, cause a few minutes ago, I was installing mysql and i had the same problem.
The matter is file rights. if you do an ls -l in the mysql directory, you will see that there is no access from the user to that directory
when u set file rights, you should also set file rights to the files that are in "data" directory. for example, to host.frm. this may be done doing chmod 777 *.* (this is the easiest way, not the one i recommend, for security questions).
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.