Added syntax highlighting #3
|
|
@ -2,12 +2,12 @@
|
|||
|
||||
## change remote url
|
||||
|
||||
```
|
||||
```bash
|
||||
git remote set-url origin <new url>
|
||||
```
|
||||
|
||||
## remove permission change from git diff
|
||||
|
||||
```
|
||||
```bash
|
||||
git config core.filemode false
|
||||
```
|
||||
|
|
@ -2,6 +2,6 @@
|
|||
|
||||
## Stashing 1 file
|
||||
|
||||
```
|
||||
```bash
|
||||
git stash push [-m <message>] [--] [<pathspec>...]
|
||||
```
|
||||
|
|
@ -2,12 +2,12 @@
|
|||
|
||||
## touch nginx config
|
||||
|
||||
```
|
||||
```bash
|
||||
sudo certbot --nginx
|
||||
```
|
||||
|
||||
## certificate only
|
||||
|
||||
```
|
||||
```bash
|
||||
sudo certbot certonly --nginx
|
||||
```
|
||||
|
|
@ -2,26 +2,26 @@
|
|||
|
||||
## Find process occupying port
|
||||
|
||||
```
|
||||
```bash
|
||||
ss -lptn 'sport = :5173'
|
||||
```
|
||||
|
||||
### Output example:
|
||||
|
||||
```
|
||||
```bash
|
||||
State Recv-Q Send-Q Local Address:Port Peer Address:Port Process
|
||||
LISTEN 0 511 [::1]:5173 [::]:* users:(("node",pid=29634,fd=32))
|
||||
```
|
||||
|
||||
## Kill process
|
||||
|
||||
```
|
||||
```bash
|
||||
sudo kill -[signal] [PID]
|
||||
```
|
||||
|
||||
### Example:
|
||||
|
||||
```
|
||||
```bash
|
||||
sudo kill -9 29634
|
||||
```
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
## By table
|
||||
|
||||
```
|
||||
```SQL
|
||||
SELECT
|
||||
TABLE_NAME,COLUMN_NAME,CONSTRAINT_NAME, REFERENCED_TABLE_NAME,REFERENCED_COLUMN_NAME
|
||||
FROM
|
||||
|
|
@ -14,7 +14,7 @@ WHERE
|
|||
|
||||
## By table column
|
||||
|
||||
```
|
||||
```SQL
|
||||
SELECT
|
||||
TABLE_NAME,COLUMN_NAME,CONSTRAINT_NAME, REFERENCED_TABLE_NAME,REFERENCED_COLUMN_NAME
|
||||
FROM
|
||||
|
|
|
|||
|
|
@ -2,13 +2,13 @@
|
|||
|
||||
## Method 1
|
||||
|
||||
```
|
||||
```SQL
|
||||
SHOW open tables WHERE In_use > 0;
|
||||
```
|
||||
|
||||
## Method 2
|
||||
|
||||
```
|
||||
```SQL
|
||||
SELECT
|
||||
OBJECT_SCHEMA,
|
||||
OBJECT_NAME,
|
||||
|
|
@ -24,6 +24,6 @@ GROUP BY
|
|||
|
||||
## Process list
|
||||
|
||||
```
|
||||
```SQL
|
||||
SHOW PROCESSLIST;
|
||||
```
|
||||
|
|
@ -2,26 +2,26 @@
|
|||
|
||||
## Show users with hosts
|
||||
|
||||
```
|
||||
```SQL
|
||||
SELECT User, Host FROM mysql.user;
|
||||
```
|
||||
|
||||
## Check user privileges
|
||||
|
||||
```
|
||||
```SQL
|
||||
SHOW GRANTS FOR 'someuser'@'somehost.somedomain';
|
||||
```
|
||||
|
||||
## Create user
|
||||
|
||||
```
|
||||
```SQL
|
||||
CREATE USER 'some_user'@'somehost.somedomain' IDENTIFIED BY 'some_password';
|
||||
FLUSH PRIVILEGES;
|
||||
```
|
||||
|
||||
## Delete user
|
||||
|
||||
```
|
||||
```SQL
|
||||
DROP USER 'some_user'@'somehost.somedomain';
|
||||
FLUSH PRIVILEGES;
|
||||
```
|
||||
|
|
@ -30,34 +30,34 @@ FLUSH PRIVILEGES;
|
|||
|
||||
### Grant all privileges
|
||||
|
||||
```
|
||||
```SQL
|
||||
GRANT ALL PRIVILEGES ON *.* TO 'some_user'@'somehost.somedomain' WITH GRANT OPTION;
|
||||
FLUSH PRIVILEGES;
|
||||
```
|
||||
|
||||
### Grant privilege on database 'some_db'
|
||||
|
||||
```
|
||||
```SQL
|
||||
GRANT SELECT ON `some_db`.* TO 'some_user'@'somehost.somedomain';
|
||||
FLUSH PRIVILEGES;
|
||||
```
|
||||
|
||||
### Grant privilege on table 'some_db'.'some_table'
|
||||
|
||||
```
|
||||
```SQL
|
||||
GRANT SELECT ON `some_db`.'some_table' TO 'some_user'@'somehost.somedomain';
|
||||
FLUSH PRIVILEGES;
|
||||
```
|
||||
|
||||
### Grant privilege to select and update some columns on table 'some_db'.'some_table'
|
||||
|
||||
```
|
||||
```SQL
|
||||
GRANT SELECT (id, some_column), UPDATE (some_column) ON `some_db`.`some_table` TO 'some_user'@'somehost.somedomain';
|
||||
```
|
||||
|
||||
### Grant with inheritance
|
||||
|
||||
```
|
||||
```SQL
|
||||
GRANT SELECT, INSERT, UPDATE, DELETE ON `some_db`.* TO 'some_user'@'somehost' WITH GRANT OPTION;
|
||||
FLUSH PRIVILEGES;
|
||||
```
|
||||
|
|
@ -68,34 +68,34 @@ FLUSH PRIVILEGES;
|
|||
|
||||
### Revoke privilege to select from database 'somedb'
|
||||
|
||||
```
|
||||
```SQL
|
||||
REVOKE SELECT ON `somedb`.* FROM 'someuser'@'somehost';
|
||||
FLUSH PRIVILEGES;
|
||||
```
|
||||
|
||||
### Revoke all privileges from user
|
||||
|
||||
```
|
||||
```SQL
|
||||
ALL PRIVILEGES ON *.* FROM 'someuser'@'somehost';
|
||||
FLUSH PRIVILEGES;
|
||||
```
|
||||
|
||||
### Revoke all privileges to database 'somedb' from user
|
||||
|
||||
```
|
||||
```SQL
|
||||
ALL PRIVILEGES ON `somedb`.* FROM 'someuser'@'somehost';
|
||||
FLUSH PRIVILEGES;
|
||||
```
|
||||
|
||||
### Revoke all privileges from user
|
||||
|
||||
```
|
||||
```SQL
|
||||
REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'someuser'@'somehost';
|
||||
FLUSH PRIVILEGES;
|
||||
```
|
||||
|
||||
## Change password
|
||||
|
||||
```
|
||||
```SQL
|
||||
ALTER USER 'test_user'@'localhost' IDENTIFIED BY 'new_password';
|
||||
```
|
||||
Loading…
Reference in New Issue