Community site: login faq

I'd like to install MySQL into my home directory so that I have full "root access" to my databases; also my application requires a newer version of MySQL than the shared instance already provided for use.

I tried following the instructions on this forum post but I get the error:

-bash: ./configure: No such file or directory

So, I think the instructions are out-of-date. Is there a newer procedure for installing MySQL on WebFaction?

asked 27 May '11, 04:53

ryans ♦♦
accept rate: 43%

edited 27 May '11, 19:15

UPDATE: Please note that as of October 2012 we now also have a one-click installer available for private MySQL instances, which in most cases will negate the need to build your own. This can be installed in the same way as any other one-click installer.

Yes. For anyone who is interested in building and maintaining their own private MySQL instance, the compilation procedure has changed compared to the old forum post regarding this topic. The new procedure follows.

In order to compile and install a private MySQL instance, you should first create a new Custom Application (listening on port) in the Control Panel. This will reserve a port for your new database server, which your applications will connect to.

Note: we are not using the Custom Application to serve the MySQL instance; it's merely reserving the port. Therefore, you should not attach the application to a website record. If you require remote access to your database, please open a support ticket to ask us to open your MySQL database port in the firewall.

Once the Custom Application (listening on port) has been created, the Control Panel will assign you a port for it. Use that port in the MY_PORT variable below.

Next, you can compile the MySQL instance into ~/mysql using the following commands. This will also install cmake into your ~/bin directory. It is required to build MySQL and you may need it in the future to build other software as well.

#### Begin MySQL Build Commands ####


mkdir -p ~/mysql/.src
cd ~/mysql/.src
wget http://www.cmake.org/files/v2.8/cmake-2.8.4.tar.gz
tar -xzf cmake-2.8.4.tar.gz
cd cmake-2.8.4
./configure --prefix=$HOME
make install

mkdir -p ~/mysql/.src ~/mysql/tmp
cd ~/mysql/.src/
# Download and extract the Mysql source code:
wget 'http://downloads.mysql.com/archives/mysql-5.5/mysql-5.5.12.tar.gz'  # md5 53d31a0b24f3eb3176185090eff129b9
tar -xzf mysql-5.5.12.tar.gz
cd mysql-5.5.12
make install

#### End MySQL Build Commands ####

Next, you will need to create the database. This can be done with something like the following commands, substituting your desired password:

#### Begin MySQL Post-Install Setup ####

echo export PATH=$HOME/mysql/bin:$HOME/mysql/scripts:$PATH >> ~/.bash_profile
source ~/.bash_profile

mysql_install_db --basedir=$HOME/mysql --datadir=$HOME/mysql/data --tmpdir=$HOME/mysql/tmp --user=$USER

# create a my.cnf file
cp $HOME/mysql/support-files/my-small.cnf $HOME/mysql/my.cnf

# Start the MySQL Server:
cd $HOME/mysql; mysqld_safe --defaults-file=$HOME/mysql/my.cnf --socket=$HOME/mysql/mysql.sock &

# Choose a password for root:
mysqladmin -u root -P $MY_PORT -S $HOME/mysql/mysql.sock password "aPasswordForRoot"

#### End MySQL Post-Install Setup ####

Next, you can test the server by connecting to it:

mysql -P $MY_PORT -S $HOME/mysql/mysql.sock -u root -p

Finally, you'll need to configure your applications to use the new database server. Specifically, you will need to configure your applications to use the following settings:

  • Database host: localhost or
  • Database port: the port assigned to your custom MySQL app in the control panel
  • Database name: the name of the database that you want to use (this must be a database that you created in your custom MySQL, not a database that you created in our control panel)
  • Database user: the user for the database that you want to use (this must be a user that you created in your custom MySQL, not a database that you created in our control panel)
  • Database password: the password assigned to your database user.

Hope that helps!

permanent link
This answer is marked "community wiki".

answered 27 May '11, 19:14

ryans ♦♦
accept rate: 43%

edited 08 Mar '13, 23:36


Thanks ! Everything worked fine for me with mysql 5.5.14. Very good post ;)

But now, how can I update the PHP MySQL Client (5.0.77) ?

With a new Apache/PHP stack ??! With this script : https://gist.github.com/924019 for example ?

What happens when the server goes down ? How can I configure autostart ?

(27 Aug '11, 09:02) BenLeTib

But now, how can I update the PHP MySQL Client (5.0.77) ?

With a new Apache/PHP stack ??! With this script : https://gist.github.com/924019 for example ?

Yes, if you need a newer version of the PHP MySQL client, then you'll need to build your own PHP stack from source.

What happens when the server goes down ? How can I configure autostart ?

You could use Supervisor to monitor your MySQL processes and restart them if they go away. Supervisor could watch your custom Apache instance also. We don't have a step-by-step tutorial for setting that up though.

Another approach would be to run a simple cron job every minute that attempts to connect to your MySQL server instance and restart it if it fails.

(27 Aug '11, 10:59) seanf

Hello, I have followed your instructions and everything seems to have gone alright except one thing: in order to connect to the database I have to specify the location of the socket file

if I write:

mysql -P $MYPORT -u root -p -S $HOME/mysql/mysql.sock

it connects without problem,

but if I omit the socket option, I receive this error:

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

so it seems that the default location of the socket file is inside the tmp directory. I could copy the file there, but I fear that it will be deleted while cleaning the tmp directory, so: how can I change the default location of the socket configuration file?

I think it is necessary because I do not know if the socket option can be passed by PHP connection string

EDIT: I managed to locate the socket in my tmp directory but still get the error message when connecting without indicating the socket location relative to my home directory. It seems that by default it looks in to the main tmp directory relative to the server root and not the local one.

(26 Mar '12, 09:52) robertotra

You can specify a different socket in PHP by defining mysql.default_socket in a php.ini file in the root of your app directory.

(26 Mar '12, 12:40) seanf

This is great. I forgot it was possible on WF to override the php.ini directives. Thank you very much !!

(26 Mar '12, 14:27) robertotra

Just a curiosity: in case one wants to upgrade in the future his/her custom installation to a next version of mysql (and considering that a backup of existing data is anyway advisable before proceeding) what do you suggest as better:

a) upgrade the existing server
b) install a new server and then migrate data


(29 Mar '12, 02:07) robertotra

Install the new server and than migrate data, its safer.

(29 Mar '12, 02:38) johns
showing 5 of 7 show 2 more comments

I followed your tutorial and MySQL is installed and running on my home directory now. I have set up PHPMyAdmin in one directory and set server hostname to, port to the assigned port and socket to $HOME/mysql/mysql.sock. I have also set the connection type to socket. However, PhpMyAdmin simply fails to connect to the MySQL server.

Please help.


permanent link
This answer is marked "community wiki".

answered 19 Jun '12, 15:21

Abhishek Das
accept rate: 0%

What error do you see when it fails?

(19 Jun '12, 15:28) seanf

It throws #1045 Cannot log in to the MySQL server

(19 Jun '12, 23:50) Abhishek Das

can you give us the command you're using to connect? You'll still need to specify the --socket

(20 Jun '12, 00:27) ryans ♦♦

I am having an issue when I get to this step:

mysql_install_db --basedir=$HOME/mysql --datadir=$HOME/mysql/data --tmpdir=$HOME/mysql/tmp --user=$USER 
Installing MySQL system tables... 
130309 1:42:17 [Warning] Ignoring user change to '<my user id>' because the user was set to 'mysql' earlier on the command line
130309 1:42:17 [ERROR] /home/<my user id>/mysql/bin/mysqld: unknown variable 'userstat=on' 
130309 1:42:17 [ERROR] Aborting
130309 1:42:18 [Note] /home/<my user id>/mysql/bin/mysqld: Shutdown complete

Any idea what this is about?

permanent link

answered 08 Mar '13, 19:51

accept rate: 0%

edited 08 Mar '13, 19:52

You need to change <my user="" id=""> wherever it is defined to your real username, it is just a default value used to explain the process.

(08 Mar '13, 23:15) johns

haha no I changed it from my user name to that <dummy> value. as you can see, the output is actually coming from mysql, and is not part of a set of instructions.

but I got some good news from tech support - there is a one-click mysql installer now: https://blog.webfaction.com/2012/10/introducing-private-mysql-instances/

(09 Mar '13, 12:58) mdemeglio
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 27 May '11, 04:53

question was seen: 12,795 times

last updated: 09 Mar '13, 12:58