LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 12-31-2016, 01:48 AM   #1
adkPrasanna
LQ Newbie
 
Registered: Mar 2016
Posts: 29

Rep: Reputation: Disabled
Edit rc.mysqld or create my.cnf to change MySQL datadir?


I want to change the data directory of MySQL Server. Which one is better? Edit rc.mysqld or create a new file my.cnf in /etc ?
 
Old 12-31-2016, 04:11 AM   #2
Alien Bob
Slackware Contributor
 
Registered: Sep 2005
Location: Eindhoven, The Netherlands
Distribution: Slackware
Posts: 8,559

Rep: Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106
Another option which works better with package upgrades: make the original mysql datadir into a symbolic link pointing to the actual location where you created your datadir.
No need to edit any file that way.
 
1 members found this post helpful.
Old 12-31-2016, 11:32 PM   #3
adkPrasanna
LQ Newbie
 
Registered: Mar 2016
Posts: 29

Original Poster
Rep: Reputation: Disabled
Smile soft link

Thanks Alien Bob for replying

I have root in /dev/sda8 where /var/lib/mysql is situated

If I format /dev/sda8 I will lost all of the MySQL data. So I want to keep /home/userName/MySQL as datadir.

If I created symbolic link, then will I be able to get data if I format /dev/sda8 and reinstall Slackware again? I'm little bit of unsure.

I tried creating hardlink but, it is not allowing for directories.

So I tried editing /etc/my.cnf for changing the datadir. But MySQL says, mysql.sock doesn't exist. It would be a great help if you guide me or suggest me some tutuorials..
 
Old 01-01-2017, 06:00 AM   #4
Alien Bob
Slackware Contributor
 
Registered: Sep 2005
Location: Eindhoven, The Netherlands
Distribution: Slackware
Posts: 8,559

Rep: Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106
It should be sufficient to do:
Code:
/etc/rc.d/rc.mysql stop
mv /var/lib/mysql /var/lib/mysql.orig
ln -s /home/userName/MySQL /var/lib/mysql
/etc/rc.d/rc.mysql start
 
1 members found this post helpful.
Old 01-01-2017, 02:48 PM   #5
Richard Cranium
Senior Member
 
Registered: Apr 2009
Location: McKinney, Texas
Distribution: Slackware64 15.0
Posts: 3,858

Rep: Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225
Drop a new file in /etc/my.cnf.d/ that changes the config for you.
 
1 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Why is mysql automatically logging me in without .my.cnf or my.cnf sections? alunduil Linux - Server 11 05-19-2010 11:52 AM
change to config file MySQL my.cnf does not take nephish Linux - Server 2 09-27-2008 11:46 AM
mySQL my.cnf (moving default datadir) not working! madfitz Linux - Newbie 4 02-09-2006 07:15 PM
How to reload /etc/my.cnf without restart mysqld? Chowroc Linux - Software 4 01-16-2006 11:52 AM
MYSQL on Slackware9.0 ./mysqld: Can't change dir to '/var/lib/mysql/' (Errcode: 13) Litn Linux - Software 2 09-02-2003 09:00 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 03:35 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration