Difference between revisions of "Command Snips"

From copec
Jump to: navigation, search
(MySQL)
Line 2: Line 2:
  
 
=== Date String Stamp ===
 
=== Date String Stamp ===
<nowiki>
+
`date '+%Y-%m-%d-%Hh%M'`
`date '+%Y-%m-%d-%Hh%M'`</nowiki>
+
  
 
=== Lock gnome >3.8 remote ===
 
=== Lock gnome >3.8 remote ===
<nowiki>
+
DISPLAY=:0 dbus-send --type=method_call --dest=org.gnome.ScreenSaver /org/gnome/ScreenSaver org.gnome.ScreenSaver.Lock
DISPLAY=:0 dbus-send --type=method_call --dest=org.gnome.ScreenSaver /org/gnome/ScreenSaver org.gnome.ScreenSaver.Lock</nowiki>
+
  
 
== MySQL ==
 
== MySQL ==
Line 13: Line 11:
 
=== Create New Database and User ===
 
=== Create New Database and User ===
 
For database 'new_db_name' and user 'new_user':
 
For database 'new_db_name' and user 'new_user':
<nowiki>
+
<nowiki>
 
mysql --defaults-file=/etc/mysql/debian.cnf  
 
mysql --defaults-file=/etc/mysql/debian.cnf  
 
CREATE DATABASE new_db_name;
 
CREATE DATABASE new_db_name;
Line 21: Line 19:
  
 
=== Update User Password ===
 
=== Update User Password ===
<nowiki>
+
<nowiki>
 
SET PASSWORD FOR 'username'@'%.example.com' = PASSWORD('good_password');</nowiki>
 
SET PASSWORD FOR 'username'@'%.example.com' = PASSWORD('good_password');</nowiki>

Revision as of 13:13, 27 October 2015

Shell

Date String Stamp

`date '+%Y-%m-%d-%Hh%M'`

Lock gnome >3.8 remote

DISPLAY=:0 dbus-send --type=method_call --dest=org.gnome.ScreenSaver /org/gnome/ScreenSaver org.gnome.ScreenSaver.Lock

MySQL

Create New Database and User

For database 'new_db_name' and user 'new_user':

mysql --defaults-file=/etc/mysql/debian.cnf 
CREATE DATABASE new_db_name;
CREATE USER 'new_user'@'localhost' IDENTIFIED BY 'good_password';
GRANT ALL PRIVILEGES ON new_db_name.* TO 'new_user'@'localhost';
FLUSH PRIVILEGES;

Update User Password

SET PASSWORD FOR 'username'@'%.example.com' = PASSWORD('good_password');