User Tools

Site Tools


build:mysql

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
build:mysql [2012/12/11 00:26]
Admin Updates for Debian Squeeze (6.0).
build:mysql [2012/12/27 23:20] (current)
Admin Generate MySQL root password.
Line 18: Line 18:
  
 ===== Password ===== ===== Password =====
- 
-NOTE: In the following instructions,​ replace $MYSQL_ROOT with the actual password. 
  
 Set the password for MySQL root user. (If this doesn'​t work, rename your ''​.my.cnf''​ file temporarily and try again). Set the password for MySQL root user. (If this doesn'​t work, rename your ''​.my.cnf''​ file temporarily and try again).
 +
 <code bash> <code bash>
-export MYSQL_ROOT=$MYSQL_ROOT +MYSQL_ROOT_PASSWORD="$(openssl rand 15 -base64 | tr '​+/'​ '​-_'​)"​ 
-sudo mysqladmin -u root password "$MYSQL_ROOT"+sudo mysqladmin -u root password "$MYSQL_ROOT_PASSWORD"
 </​code>​ </​code>​
  
 Create root's MySQL configuration file, and make sure nobody else can read it: Create root's MySQL configuration file, and make sure nobody else can read it:
 +
 <code bash> <code bash>
 sudo touch /​root/​.my.cnf sudo touch /​root/​.my.cnf
Line 34: Line 34:
  
 Edit the ''/​root/​.my.cnf''​ file to set the password when using various client programs: Edit the ''/​root/​.my.cnf''​ file to set the password when using various client programs:
-<​code>​+ 
 +<​code ​bash> 
 +sudo sh -c 'cat >> /​root/​.my.cnf'​ <<EOF
 [mysql] [mysql]
 user     = '​root'​ user     = '​root'​
-password = '$MYSQL_ROOT' ​# THIS IS NOT THE REAL PASSWORD; DO NOT CUT AND PASTE THIS!+password = '$MYSQL_ROOT_PASSWORD'
  
 [mysqladmin] [mysqladmin]
 user     = '​root'​ user     = '​root'​
-password = '$MYSQL_ROOT' ​# THIS IS NOT THE REAL PASSWORD; DO NOT CUT AND PASTE THIS!+password = '$MYSQL_ROOT_PASSWORD' 
 +EOF
 </​code>​ </​code>​
  
Line 54: Line 57:
  
 See ''/​usr/​share/​doc/​mysql-server-5.0/​README.Debian.gz''​ for more information. See ''/​usr/​share/​doc/​mysql-server-5.0/​README.Debian.gz''​ for more information.
 +
  
 ===== TODO ===== ===== TODO =====
Line 60: Line 64:
  
 Backups. Backups.
 +
build/mysql.txt · Last modified: 2012/12/27 23:20 by Admin