Tag: MySQL

2 Posts

MySQL Install
Windows my.ini [mysqld] port = 3000 basedir = D:\Program Files\mysql-8.0.31 datadir = D:\Program Files\mysql-8.0.31\data secure-file-priv = NULL # user-defined skip-name-resolve character-set-server = utf8mb4 default-time-zone = '+8:00' innodb_rollback_on_timeout = 'ON' max_connections = 1000 innodb_lock_wait_timeout = 500 shared-memory default-authentication-plugin = mysql_native_password general_log = 1 slow_query_log = 1 log-error = D:\Program Files\mysql-8.0.31\logs\error.log log-bin = mysql-bin # log_replica_updates user = mysql sql_mode = 'STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION' # cert # ssl-ca = "D:\Program Files\mysql-8.0.19\data\mysql-server.crt" # ssl-cert = "D:\Program Files\mysql-8.0.19\data\mysql-server.crt" # ssl-key = "D:\Program Files\mysql-8.0.19\data\mysql-server.key" connect_timeout = 10 interactive_timeout = 28800 wait_timeout = 28800 # validate_password.length = 10 # validate_password.number_count = 2 # plugin-load-add = # connection_control.dll # connection-control = FORCE # connection-control-failed-login-attempts = FORCE # connection_control_min_connection_delay = 1000 # connection_control_max_connection_delay = 86400 # connection_control_failed_connections_threshold = 3 # innodb_buffer_pool_size = 4G # innodb_log_buffer_size = 256M # innodb_log_file_size = 1G # innodb_write_io_threads = 16 # innodb_flush_log_at_trx_commit = 0 # innodb_doublewrite = 0 # Row size too large # innodb_strict_mode=0 [mysql] local_infile = 0 [client] port=3000 default-character-set=utf8mb4 install create my.ini create logs create app # init bin\mysqld.exe --initialize --console # install service bin\mysqld.exe install mysql8…
MySQL
Database -- create CREATE DATABASE `dbname` CHARACTER SET 'utf8mb4' COLLATE 'utf8mb4_general_ci'; User -- create user CREATE USER 'test' @'10.10.10.1' IDENTIFIED WITH mysql_native_password BY '123456' REQUIRE SSL PASSWORD EXPIRE INTERVAL 90 DAY; -- grant privileges GRANT ALL PRIVILEGES ON `dbname`.* TO 'test' @'10.10.10.1'; -- grant SELECT -- select, insert, update, delete GRANT SELECT ON`invent`.* TO 'test' @'10.10.10.1'; -- flush FLUSH PRIVILEGES; -- select user SELECT `host`, `user`, `plugin`, `authentication_string` FROM `user`; -- show user grants SHOW GRANTS FOR 'test' @'10.10.10.1'; -- revoke privileges REVOKE ALL PRIVILEGES ON `invent`.* FROM 'test' @'10.10.10.1'; -- delete user DROP USER 'test' @'10.10.10.1'; -- flush privileges FLUSH PRIVILEGES; -- modify password ALTER USER 'test' @'10.10.10.1' IDENTIFIED WITH mysql_native_password BY '123456'; -- select user SELECT `USER`, `HOST`, password_last_changed, password_lifetime, password_expired FROM mysql.USER; Config -- select all columns SELECT * FROM information_schema.`COLUMNS` WHERE table_name = 'sys_user'; -- version SELECT version(); -- is suport ssl SHOW VARIABLES LIKE '%ssl%'; -- port SHOW VARIABLES LIKE 'port'; -- datadir SHOW VARIABLES LIKE 'datadir'; -- update table name to upper SELECT concat( "alter table ", TABLE_NAME, '…