redhat

How to transfer files over SSH/SCP

I often forget the syntax for getting files over a SSH connection.

scp user@address:/path/to/file /path/of/new/file

For example:

scp root@domain.com:/tmp/mysql/test.sql .

Will transfer test.sql to the current folder (.) Also, if you need to change the port, just use the -P option

scp -P 9000 user@address:/path/to/file .

If you want to transfer a file TO another server:

scp /path/of/file user@address:/path/to/new/location

 

How to install MySQL Server on Centos

To install MySQL on Centos is a little different from Ubuntu – as I found out. Obviously APT is replaced with yum on this flavour of Linux, but not only that, yum doesn’t appear to set it up for you after installing it (with root account, etc).

Step 1, Install MySQL

> yum install mysql-server mysql

This will download the files and install them in the correct folders, as apptitude would. Step 2 shows you how to prepare the MySQL service.

Step 2, Configure the service

Tell the system to start the MySQL Daemon upon startup:

chkconfig --levels 235 mysqld on
service mysqld start

Now MySQL is installed and running, but the root account will have no password, so we need to ensure there is a strong one. (Or not if you are a crazy one) – You will get some message when the service starts for the first time related to security measures, I would suggest you do read it.

Step 3, Set up Root user

> mysql -u root
> SET PASSWORD FOR 'root'@'%' = PASSWORD(<password>);

Replace <password> with your desired password.

Obviously change the root user details based on your particular set up. I.e. where the root account can connect from, which servers, ips, etc.