LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 11-16-2010, 09:17 AM   #1
nichis
LQ Newbie
 
Registered: Nov 2010
Posts: 7

Rep: Reputation: 0
how to install mysql-server into a pendrive


hello everybody
i need to install mysql-server into a pendrive because i want to use a database into the pendrive..

i'm using debian, and i tried to put the var/lib/mysql directory into the pendrive, then i modified the my.cnf file with this string:
datadir = /media/pen/database/mysql
(the path into the pendrive is database/mysql)
instead of:
datadir = /var/lib/mysql

but now when i write "mysql -u root -p" i receice this error:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (111)

i think because i have to install mysql into the pendrive, isn't it?

please helm me!!
thanks
nichis
 
Old 11-16-2010, 10:06 AM   #2
d072330
Member
 
Registered: Nov 2007
Location: USA
Distribution: CentOS 5/6
Posts: 186

Rep: Reputation: 6
mysqld.sock

My guess is that '/var/run/mysqld/mysqld.sock' does not exist or does not have the right permissions for mysql to write to it.

Create '/var/run/mysqld/mysqld.sock' and chown to user mysql. If you can then start mysql service you can try linking this file to your pendrive.

# cd /var/lib/mysql/
# ln -s /var/run/mysqld/mysqld.sock mysql.sock
 
Old 11-16-2010, 10:42 AM   #3
nichis
LQ Newbie
 
Registered: Nov 2010
Posts: 7

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by d072330 View Post
My guess is that '/var/run/mysqld/mysqld.sock' does not exist or does not have the right permissions for mysql to write to it.

Create '/var/run/mysqld/mysqld.sock' and chown to user mysql. If you can then start mysql service you can try linking this file to your pendrive.

# cd /var/lib/mysql/
# ln -s /var/run/mysqld/mysqld.sock mysql.sock

Thanks for the answer,
i have created '/var/run/mysqld/mysqld.sock' and put the permission (777), then i have created the link, but i haven't understand how to link it into the pendrive..
i receive always the same error
 
Old 11-16-2010, 11:18 AM   #4
d072330
Member
 
Registered: Nov 2007
Location: USA
Distribution: CentOS 5/6
Posts: 186

Rep: Reputation: 6
did you try and start mysql before creating the symlink?
 
Old 11-16-2010, 11:26 AM   #5
nichis
LQ Newbie
 
Registered: Nov 2010
Posts: 7

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by d072330 View Post
did you try and start mysql before creating the symlink?
yes, i had the same error..
 
Old 11-16-2010, 11:52 AM   #6
d072330
Member
 
Registered: Nov 2007
Location: USA
Distribution: CentOS 5/6
Posts: 186

Rep: Reputation: 6
Did you install mysql on the local machine then tried to move things to the pendrive?

Did you install mysql using tar file or rpm?

If you tried the install via the rpm package I would suggest you download the tar file for the version of mysql that you want to install and untar the tar file onto your pendrive.

This is for Windows but you could sort of follow for a Linux install.
 
Old 11-16-2010, 01:13 PM   #7
nichis
LQ Newbie
 
Registered: Nov 2010
Posts: 7

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by d072330 View Post
Did you install mysql on the local machine then tried to move things to the pendrive?

Did you install mysql using tar file or rpm?

If you tried the install via the rpm package I would suggest you download the tar file for the version of mysql that you want to install and untar the tar file onto your pendrive.

This is for Windows but you could sort of follow for a Linux install.
yes, i installed it using apt-get.. and it works, i had the problems when i tried to put the database into the pendrive
 
Old 11-16-2010, 01:23 PM   #8
szboardstretcher
Senior Member
 
Registered: Aug 2006
Location: Detroit, MI
Distribution: GNU/Linux systemd
Posts: 4,278

Rep: Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694
Quote:
Originally Posted by d072330 View Post
My guess is that '/var/run/mysqld/mysqld.sock' does not exist or does not have the right permissions for mysql to write to it.

Create '/var/run/mysqld/mysqld.sock' and chown to user mysql. If you can then start mysql service you can try linking this file to your pendrive.

# cd /var/lib/mysql/
# ln -s /var/run/mysqld/mysqld.sock mysql.sock
I believe that he will require making a symlink to the pendrive, where the configuation is pointing.

datadir = /media/pen/database/mysql

So you would shutdown mysql. Go to /var/run/mysqld/. Create a symlink that points to /media/pen/database/mysql like this (cd /var/run/mysqld; ln -s /media/pen/database/mysql/mysql.sock mysql.sock)

Then try starting again. It should link over to where mysql is actually writing that file now.
 
Old 11-17-2010, 10:06 AM   #9
nichis
LQ Newbie
 
Registered: Nov 2010
Posts: 7

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by szboardstretcher View Post
I believe that he will require making a symlink to the pendrive, where the configuation is pointing.

datadir = /media/pen/database/mysql

So you would shutdown mysql. Go to /var/run/mysqld/. Create a symlink that points to /media/pen/database/mysql like this (cd /var/run/mysqld; ln -s /media/pen/database/mysql/mysql.sock mysql.sock)

Then try starting again. It should link over to where mysql is actually writing that file now.
i think i have resolved this cutting the content of /var/lib/mysql and putting all it into /pen/database/mysql
then into the my.cnf file i put " datadir = /media/pen/database/mysql "

but now i have the problem that i can't create other databases , i receive this error:

ERROR 1006 (HY000): Can't create database 'asd' (errno: 13)
 
Old 11-18-2010, 12:54 PM   #10
nichis
LQ Newbie
 
Registered: Nov 2010
Posts: 7

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by nichis View Post
but now i have the problem that i can't create other databases , i receive this error:

ERROR 1006 (HY000): Can't create database 'asd' (errno: 13)
i note that mysql process hasn't permission to create a new folder on the pendrive
the strange thing is that when i do
"chmod -R 777 /media/pen/database/mysql"
nothing happen!!.. it remain 755 :S ... why??

root@debian:/media/pen/database# ls -l
total 4
drwxr-xr-x 5 root root 4096 Nov 18 17:48 mysql
 
Old 11-18-2010, 01:19 PM   #11
d072330
Member
 
Registered: Nov 2007
Location: USA
Distribution: CentOS 5/6
Posts: 186

Rep: Reputation: 6
Quote:
drwxr-xr-x 5 root root 4096 Nov 18 17:48 mysql

Make this folder owned by mysql by doing this:

chown -R mysql:mysql /media/pen/database/mysql

Then see if anything changes.
 
Old 11-20-2010, 04:59 AM   #12
nichis
LQ Newbie
 
Registered: Nov 2010
Posts: 7

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by d072330 View Post
Make this folder owned by mysql by doing this:

chown -R mysql:mysql /media/pen/database/mysql

Then see if anything changes.
it doesn't work ..
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
is there a client install for MySql so PHP can connect to MySQL Server? alar Linux - Software 8 07-03-2007 07:42 PM
mysql error Can't connect to local MySQL server through socket '/var/lib/mysql/mysql. SpellChainz Linux - Newbie 1 06-23-2007 03:35 PM
How to install and configure grub on pendrive while os' are on the same pendrive? CeremCem DamnSmallLinux 0 11-07-2006 11:10 AM
mysql error Can't connect to local MySQL server through socket '/var/lib/mysql/mysql. Dannux Linux - Software 3 03-24-2006 08:44 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 04:51 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