Bootstrap

How can I install mySQL on CentOS without being root/su?

  1. Download MySQL Community Server 5.5.8 Linux - Generic Compressed TAR Archive
  2. Unpack it. For example to: /home/martin/mysql
  3. Create 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
    

    Note that --defaults-file MUST be the first parameter, otherwise it won't work! It's a MySQL bug.

  5. Your MySQL server is ready. Start it with this command:

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

    Connecting to server:

    mysql -h 127.0.0.1 -P 3666 -u root -p (using tcp)
    

    or

    mysql --socket=/home/martin/socket -u root -p (using unix socket)
    

    Shutting down server:

    mysqladmin -h 127.0.0.1 -P 3666 -u root shutdown(using tcp)
    

    or

    mysqladmin --socket=/home/martin/socket -u root shutdown (using unix socket)
;