linux

How to start a Linux command in background

Submitted by admin on Sun, 05/19/2019 - 09:43

Start a Linux Process or a Command in Background

simply press Ctrl+Z to stop it then enter the command bg to continue with its execution in the background as a job. Or you can use the ampersand sign & at the end of a command to directly run a process in the background 

# some_long_command &

You can view all your background jobs by typing jobs

 

How to connect to remote MySql server

Submitted by admin on Sun, 02/18/2018 - 16:49

To do so you should enable connection from the remote server.

In DirectAdmin:

go to "MySQL Management"  and click on each domain name you want to have access remotely, in section "Access Hosts" below the page you should add the IP address of the remote server and then click on the "Add Host" button.

 

In command line:

login to your MySQL console with root access

mysql -u root -p

then run the following command:

How to backing up database by its table and restore them to new database

Submitted by admin on Thu, 02/15/2018 - 12:30

for creating separated files for each table:

for x in `mysql --skip-column-names -u <source_username> -p<source_password> <source_database_name> -e 'show tables;'`;
do
     echo "file=$x"
     mysqldump -u <source_username> -p<source_password> <source_database_name> $x > "$x.sql"
done

 

for restoring all .sql files that we have been created in the previous step to our new database

Linux Server .conf Files Directory

Submitted by admin on Tue, 08/02/2016 - 19:37

Default options are read from the following files in the given order:


Default options are read from the following files in the given order:
/etc/my.cnf
/etc/mysql/my.cnf
/usr/etc/my.cnf
~/.my.cnf

restarting mysql or mysqld services


service mysqld start
service mysqld stop
service mysqld restart

Useful Linux Commands

Submitted by admin on Tue, 08/02/2016 - 19:32

Dealing with crontab

crontab [-u user] [-l | -r | -e] [-i] [-s]
-u  user Specifies the user whose crontab is to be viewed or modified. If this option is not given, crontab opens the crontab of the user who ran crontab.