Command Line Tips

Remote Connection

To connect to your database remotely, tunnel in via SSH.

Run this command on your local machine:

ssh -fNg -L 8888:127.0.0.1:3306 login@Slice-IP-Address

This creates an encrypted tunnel to your Slice’s mySQL port (3306) on your local port of 8888. Point your local admin/GUI app to localhost:8888. If this does not work, and you are running OS X with Sequel Pro try pointing it to 0.0.0.0:8888 instead.

If you are running OS X with Sequel Pro you can use the following configurations to create a SSH tunnel. You can also add the configuration to your favorites for ease of future use.

Secure Initial MySQL root account

Secure the MySQL root password. To find your host name enter ‘hostname’ in at the command line.

user@server#> hostname
yourhostname
user@server#> mysql -u root
mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('newpwd');
mysql> SET PASSWORD FOR 'root'@'yourhostname' = PASSWORD('newpwd');
mysql> exit

Remember to clean your history file, as the password in clear text will remain otherwise.

user@server#> rm ~/.mysql_history

Alternatively, you can run the “mysql_secure_installation” script, where you can set the root password, remove the anonymous user, and the test database.

Tuning

Backups

 
/var/www/dokuwiki/data/pages/mysql_tips.txt · Last modified: 2010/03/17 00:54 by arimus
 
Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki
© Slicehost 2006-2007