Initial import
This commit is contained in:
6
DOC/README.save-grants
Normal file
6
DOC/README.save-grants
Normal file
@ -0,0 +1,6 @@
|
||||
|
||||
## - ----------------------------------------------------------------
|
||||
## - Datenbank User und deren Rechte auslesen
|
||||
## - ----------------------------------------------------------------
|
||||
mysql -uroot -pbuz111 mysql --skip-column-name -A -e"SELECT CONCAT('SHOW GRANTS FOR ''',user,'''@''',host,''';') FROM mysql.user WHERE user<>'';" | mysql -uroot -pbuz111 mysql --skip-column-name -A | sed 's/$/;/g' > ~/mysql-grants.sql
|
||||
|
45
DOC/Readme.PASSWORD_EXPIRED
Normal file
45
DOC/Readme.PASSWORD_EXPIRED
Normal file
@ -0,0 +1,45 @@
|
||||
|
||||
Fehrelmeldung:
|
||||
|
||||
mysqladmin: connect to server at 'localhost' failed
|
||||
error: 'Your password has expired. To log in you must change it using a client that supports expired passwords.'
|
||||
|
||||
|
||||
Password Expiration Policy
|
||||
==========================
|
||||
|
||||
# default_password_lifetime
|
||||
#
|
||||
# This variable defines the global automatic password expiration policy. It applies
|
||||
# to accounts that use MySQL built-in authentication methods (accounts that use an
|
||||
# authentication plugin of mysql_native_password, mysql_old_password, or sha256_password).
|
||||
#
|
||||
# The default default_password_lifetime value is 0, which disables automatic password
|
||||
# expiration. If the value of default_password_lifetime is a positive integer N, it
|
||||
# indicates the permitted password lifetime; passwords must be changed every N days.
|
||||
|
||||
# The global password expiration policy can be overridden as desired for individual
|
||||
# accounts using the ALTER USER statement. See Section 7.3.6, “Password Expiration Policy”.
|
||||
#
|
||||
# ! Note !
|
||||
#
|
||||
# From MySQL 5.7.4 to 5.7.10, the default default_password_lifetime value is 360 (passwords
|
||||
# must be changed approximately once per year). For those versions, be aware that, if you
|
||||
# make no changes to the default_password_lifetime variable or to individual user accounts,
|
||||
# all user passwords will expire after 360 days, and all user accounts will start running
|
||||
# in restricted mode when this happens. Clients (which are effectively users) connecting to
|
||||
# the server will then get an error indicating that the password must be changed:
|
||||
# ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing
|
||||
# this statement.
|
||||
|
||||
# However, this is easy to miss for clients that automatically connect to the server, such
|
||||
# as connections made from scripts. To avoid having such clients suddenly stop working due
|
||||
# to a password expiring, make sure to change the password expiration settings for those clients,
|
||||
# like this:
|
||||
#
|
||||
# ALTER USER 'script'@'localhost' PASSWORD EXPIRE NEVER
|
||||
#
|
||||
# Alternatively, set the default_password_lifetime variable to 0, thus disabling automatic
|
||||
# password expiration for all users.
|
||||
#
|
||||
default_password_lifetime = 0
|
130
DOC/mysql.txt
Normal file
130
DOC/mysql.txt
Normal file
@ -0,0 +1,130 @@
|
||||
## - ----------------------------------------------------------------
|
||||
## - MySql Superuser anlegen
|
||||
## - ----------------------------------------------------------------
|
||||
|
||||
## - Bemerkung:
|
||||
## - Das Passwort wird verschl<68>sselt abgespeichert
|
||||
|
||||
## - Von <20>berall:
|
||||
## -
|
||||
GRANT ALL PRIVILEGES ON *.* TO 'admin' IDENTIFIED BY 'Nyz!aB2u' WITH GRANT OPTION ;
|
||||
FLUSH PRIVILEGES;
|
||||
|
||||
## - Nur von loacalhost
|
||||
## -
|
||||
GRANT ALL PRIVILEGES ON *.* TO 'admin'@'localhost' IDENTIFIED BY 'Nyz!aB2u' WITH GRANT OPTION ;
|
||||
FLUSH PRIVILEGES;
|
||||
|
||||
|
||||
|
||||
## - ----------------------------------------------------------------
|
||||
## - Dantenbank anlegen, User anlegen mit vollen Rechten auf der Datenbank
|
||||
## - ----------------------------------------------------------------
|
||||
|
||||
CREATE DATABASE <new_db_name> CHARACTER SET utf8 COLLATE utf8_general_ci;
|
||||
GRANT ALL ON new_db.* TO 'new_user'@'localhost' IDENTIFIED BY 'password';
|
||||
FLUSH PRIVILEGES;
|
||||
|
||||
|
||||
## - Dantenbank anlegen, User mit eingeschrenkten Rechten auf der Datenbank
|
||||
## -
|
||||
## - Beispiel: vpopmail
|
||||
## -
|
||||
CREATE DATABASE vpopmail;
|
||||
GRANT select,insert,update,delete,create,drop ON vpopmail.* TO 'vpop'@'localhost' IDENTIFIED BY 'r23myzmx';
|
||||
FLUSH PRIVILEGES;
|
||||
|
||||
|
||||
## - ----------------------------------------------------------------
|
||||
## - Zeige alle Views einer Datenbank
|
||||
## - ----------------------------------------------------------------
|
||||
|
||||
SHOW FULL TABLES IN <db_name> WHERE TABLE_TYPE LIKE 'VIEW'
|
||||
|
||||
|
||||
## - ----------------------------------------------------------------
|
||||
## - Zeige Definition eines Views
|
||||
## - ----------------------------------------------------------------
|
||||
|
||||
show CREATE VIEW <view_name>;
|
||||
|
||||
|
||||
## - ----------------------------------------------------------------
|
||||
## - Datenbank User und deren Rechte auslesen
|
||||
## - ----------------------------------------------------------------
|
||||
mysql -uroot -pbuz111 mysql --skip-column-name -A -e"SELECT CONCAT('SHOW GRANTS FOR ''',user,'''@''',host,''';') FROM mysql.user WHERE user<>'';" | mysql -uroot -pbuz111 mysql --skip-column-name -A | sed 's/$/;/g' > ~/mysql-grants.sql
|
||||
|
||||
|
||||
|
||||
## - ----------------------------------------------------------------
|
||||
## - Convert databese from current latin1 to utf8
|
||||
## - ----------------------------------------------------------------
|
||||
|
||||
db_name=<database-name>
|
||||
db_user=<database-user>
|
||||
db_pass=<database-password>
|
||||
|
||||
old_charset=latin1
|
||||
#old_collate=latin1_swedish_ci - NOT NEEDED
|
||||
new_charset=utf8
|
||||
new_collate=utf8_unicode_ci
|
||||
|
||||
## - 1.) dump the databse as follows:
|
||||
dumpfile=${db_name}-${old_charset}.`date +%Y%m%d-%H%M`.sql
|
||||
mysqldump -u$db_user -p$db_pass --set-charset --skip-set-charset --add-drop-table $db_name > $dumpfile
|
||||
|
||||
## - 2.) change character settings on mysql monitor
|
||||
query="ALTER DATABASE \`$db_name\` DEFAULT CHARACTER SET $new_charset DEFAULT COLLATE $new_collate;"
|
||||
mysql -u$db_user -p$db_pass $db_name -e "$query"
|
||||
|
||||
## - 3.) Load he dumpfile
|
||||
mysql -u$db_user -p$db_pass --default-character-set=$old_charset $db_name < $dumpfile
|
||||
|
||||
## - 4.) show result
|
||||
mysql -u$db_user -p$db_pass $db_name -e "SHOW CREATE DATABASE $db_name\G"
|
||||
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------------------------
|
||||
|
||||
## - dump database WITHOUT CREATE TABLE Statements - useful, if you
|
||||
## - want add entries into existing tables of an existing database,
|
||||
## - i.e. database "mysql"
|
||||
## -
|
||||
mysqldump -uroot -p --add-locks --disable-keys --extended-insert \
|
||||
--lock-tables --quick --set-charset --no-create-info mysql > db_mysql.sql
|
||||
|
||||
## - durmp table "user" from database mysql without CREATE TABLE statment
|
||||
## -
|
||||
mysqldump -uroot -pbuz111 --add-locks --disable-keys --extended-insert --lock-tables --quick --set-charset --no-create-info mysql user | sed 's#),(#);\n(#g' | sed 's#^(#INSERT INTO `user` VALUES (#' > mysql-user.sql
|
||||
|
||||
|
||||
## - restore
|
||||
mysql -uroot -pbuz111 -f mysql < mysql-user.sql
|
||||
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
## charset f<>r den MySQL monitor einstellen
|
||||
##
|
||||
mysql> SET CHARACTER SET UTF8;
|
||||
## bzw.
|
||||
mysql> \C utf8
|
||||
|
||||
|
||||
## zeige Server-Konfiguration
|
||||
##
|
||||
mysql> SHOW VARIABLES;
|
||||
|
||||
mysql> SHOW /*!50000 global */ VARIABLES ;
|
||||
mysql> SHOW /*!50000 global */ VARIABLES LIKE "%slow%";
|
||||
|
||||
|
||||
## - Zeige Sever Status
|
||||
## -
|
||||
mysql> SHOW STATUS ;
|
||||
|
||||
mysql> SHOW /*!50000 global */ STATUS ;
|
||||
mysql> SHOW /*!50000 global */ STATUS LIKE "slow%";
|
Reference in New Issue
Block a user