Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to install MySQL without root permissions. I ran through the following steps:

  1. Download MySQL Community Server 5.5.8 Linux - Generic Compressed TAR Archive
  2. Unpack it, for example to: /home/martin/mysql
  3. Create a my.cnf file in your home directory. The file contents should be:

    [server]
    user=martin
    basedir=/home/martin/mysql
    datadir=/home/martin/sql_data
    socket=/home/martin/socket
    port=3666
    
  4. Go to the /home/martin/mysql directory and execute:

    ./scripts/mysql_install_db --defaults-file=~/my.cnf --user=martin --basedir=/home/martin/mysql --datadir=/home/martin/sql_data --socket=/home/martin/socket
    
  5. Your MySQL server is ready. Start it with this command:

    ./bin/mysqld_safe --defaults-file=~/my.cnf &
    

When I try to change the password of MySQL it gives the error:

Cannot connect to mysql server through socket '/tmp/mysql.sock'

How can I change this path and see whether the mysql.sock is created or not?

share|improve this question

change the socket=/home/martin/socket to /tmp/mysql.sock

share|improve this answer

You should follow the guide http://www.bluecrownsoftware.com/article/271/Installing-MySQL-without-Root-Access-on-Linux.

Then start the command line with:

mysql --socket={yourpath}/yourname.sock
share|improve this answer

You should name your my.cnf file ~/.my.cnf for it to be picked up by mysqladmin. Also, you will need to add the following configuration to the ~/.my.cnf file:

[client]
socket=/home/martin/socket
share|improve this answer

If you define host and port, changing of the password should work in one line:

/home/martin/mysql/bin/mysqladmin -h 127.0.0.1 -P 3666 -u root password 'mypass'
share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .