LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   how to install mysql-server into a pendrive (https://www.linuxquestions.org/questions/linux-software-2/how-to-install-mysql-server-into-a-pendrive-844616/)

nichis 11-16-2010 09:17 AM

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

d072330 11-16-2010 10:06 AM

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

nichis 11-16-2010 10:42 AM

Quote:

Originally Posted by d072330 (Post 4160785)
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

d072330 11-16-2010 11:18 AM

did you try and start mysql before creating the symlink?

nichis 11-16-2010 11:26 AM

Quote:

Originally Posted by d072330 (Post 4160862)
did you try and start mysql before creating the symlink?

yes, i had the same error..

d072330 11-16-2010 11:52 AM

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.

nichis 11-16-2010 01:13 PM

Quote:

Originally Posted by d072330 (Post 4160903)
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

szboardstretcher 11-16-2010 01:23 PM

Quote:

Originally Posted by d072330 (Post 4160785)
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.

nichis 11-17-2010 10:06 AM

Quote:

Originally Posted by szboardstretcher (Post 4160985)
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)

nichis 11-18-2010 12:54 PM

Quote:

Originally Posted by nichis (Post 4161980)
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

d072330 11-18-2010 01:19 PM

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.

nichis 11-20-2010 04:59 AM

Quote:

Originally Posted by d072330 (Post 4163441)
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 :( ..


All times are GMT -5. The time now is 02:56 AM.