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

mysql-backup.png

Mysql

Step 0: Read useful links

http://dev.mysql.com/doc/mysql-apt-repo-quick-guide/en/ https://www.digitalocean.com/community/tutorials/mysql-ru http://dba.stackexchange.com/questions/76788/how-to-create-database-with-charset-utf-8 http://ruhighload.com/post/%D0%9A%D0%B0%D0%BA+%D0%BD%D0%B0%D1%81%D1%82%D1%80%D0%BE%D0%B8%D1%82%D1%8C+MySQL+Master-Slave+%D1%80%D0%B5%D0%BF%D0%BB%D0%B8%D0%BA%D0%B0%D1%86%D0%B8%D1%8E

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';
FLUSH PRIVILEGES;

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;

or

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';
FLUSH PRIVILEGES;

or

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

or

mysqladmin -u username password passwordphrase

GitHub – denisgolius

Denis

Ukraine

https://www.linkedin.com/in/denis-golius-1088b79b https://www.facebook.com/michaelweiss1234