Difference between revisions of "Command Snips"

From copec
Jump to: navigation, search
Line 7: Line 7:
  
 
=== Create New Database and User ===
 
=== Create New Database and User ===
 +
For database 'new_db_name' and user 'new_user':
 
  <nowiki>mysql --defaults-file=/etc/mysql/debian.cnf  
 
  <nowiki>mysql --defaults-file=/etc/mysql/debian.cnf  
CREATE DATABASE database_name;
+
CREATE DATABASE new_db_name;
CREATE USER 'foo'@'localhost' IDENTIFIED BY 'password';
+
CREATE USER 'new_user'@'localhost' IDENTIFIED BY 'good_password';
GRANT ALL PRIVILEGES ON database_name.* TO 'foo'@'localhost';
+
GRANT ALL PRIVILEGES ON new_db_name.* TO 'new_user'@'localhost';
 
FLUSH PRIVILEGES;</nowiki>
 
FLUSH PRIVILEGES;</nowiki>

Revision as of 10:54, 31 March 2015

Shell

Date String Stamp

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

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;