How to set rights recursive for dirrectories and files

To recursively give directories read&execute; privileges:

find /path/to/base/dir -type d -exec chmod 755 {} +

To recursively give files read privileges:

find /path/to/base/dir -type f -exec chmod 644 {} +

Or, if there are many objects to process:

chmod 755 $(find /path/to/base/dir -type d)
chmod 644 $(find /path/to/base/dir -type f)

Or, to reduce chmod spawning:

find /path/to/base/dir -type d -print0 | xargs -0 chmod 755 
find /path/to/base/dir -type f -print0 | xargs -0 chmod 644

How to fully remove docker from your OS ?

sudo apt-get purge -y docker-engine
sudo apt-get autoremove -y --purge docker-engine
sudo apt-get autoclean
sudo rm -rf /var/lib/docker
sudo rm /etc/apparmor.d/docker
sudo groupdel docker

Frequently used mysql commands



Step 0: Read useful links

Step 1: Update your system by typing the following commands:

sudo apt update
sudo apt upgrade

Step 2: Install mysql version 5.7 on Ubuntu 16.04

sudo apt install mysql-server mysql-client

Step 3: Run mysql_secure_installation to secure your installation

sudo mysql_secure_installation

Step 4: How do I use MySQL server?

$ mysql -u root -p

Step 5: How do I create a new MySQL server database and user account?

CREATE DATABASE mydatabase CHARACTER SET utf8 COLLATE utf8_general_ci;
CREATE USER 'newuser'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON * . * TO 'newuser'@'localhost';

Grant privileges for user on database.table

GRANT [тип прав] ON [database's name].[table's name] TO [username]@'localhost;

Show user in MySQL:

mysql> select * from mysql.user;


mysql> select host, user, password from mysql.user;

Remove rights for user

REVOKE [тип прав] ON [database's name].[table's name FROM [username]@localhost;

Remove database from mysql server

DROP USER demo@localhost;

How to change password for some user in MySQL

SET PASSWORD = PASSWORD('passwordphrase')

Password for some user can be changed by this commands:

SET PASSWORD FOR username@localhost = PASSWORD('passwordphrase');
SET PASSWORD FOR username@"%" = PASSWORD('passwordphrase');

The same is can be done by these commands:

UPDATE mysql.user SET Password=PASSWORD('passwordphrase') WHERE User='логин' AND Host='localhost';


GRANT USAGE ON БД.* TO username@localhost IDENTIFIED BY 'passwordphrase';


mysqladmin -u username password passwordphrase

GitHub – denisgolius