my.ini
[mysql]
# 设置mysql客户端默认字符集 default-character-set=utf8 [mysqld] #设置3306端口 port = 3306 # 设置mysql的安装目录 basedir=D:\winApp\mysql-5.7.24-winx64 # 设置mysql数据库的数据的存放目录 datadir=D:\winApp\mysql-5.7.24-winx64\data # 允许最大连接数 max_connections=200 # 服务端使用的字符集默认为8比特编码的latin1字符集 character-set-server=utf8 # 创建新表时将使用的默认存储引擎 default-storage-engine=INNODB
#C:\Users\Administrator>mysqld --remove mysql
#Service successfully removed. # #C:\Users\Administrator>mysqld --initialize --user=mysql --console #2018-11-15T10:34:38.528400Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is # deprecated. Please use --explicit_defaults_for_timestamp server option (see doc #umentation for more details). #2018-11-15T10:34:39.423400Z 0 [Warning] InnoDB: New log files created, LSN=45790 # #2018-11-15T10:34:39.733400Z 0 [Warning] InnoDB: Creating foreign key constraint #system tables. #2018-11-15T10:34:39.867400Z 0 [Warning] No existing UUID has been found, so we a #ssume that this is the first time that this server has been started. Generating #a new UUID: 0e7558c3-e8c2-11e8-9348-107b447f9b4a. #2018-11-15T10:34:39.888400Z 0 [Warning] Gtid table is not ready to be used. Tabl #e 'mysql.gtid_executed' cannot be opened. #2018-11-15T10:34:42.721400Z 1 [Note] A temporary password is generated for root@ #localhost: S_Dwn?cZQ9a+#"C:\Program Files\MySQL\MySQL Server 5.7\mysqld" mysqld install MYSQL --defaults-file=D:\winApp\mysql-5.7.24-winx64\bin\my.ini
#D:\winApp\mysql-5.7.24-winx64\bin>mysqld --remove MYSQL #Service successfully removed. # #D:\winApp\mysql-5.7.24-winx64\bin>mysqld --initialize --user=mysql --console #2018-11-16T00:56:41.695000Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is # deprecated. Please use --explicit_defaults_for_timestamp server option (see doc #umentation for more details). #2018-11-16T00:56:42.578000Z 0 [Warning] InnoDB: New log files created, LSN=45790 # #2018-11-16T00:56:42.902000Z 0 [Warning] InnoDB: Creating foreign key constraint #system tables. #2018-11-16T00:56:43.081000Z 0 [Warning] No existing UUID has been found, so we a #ssume that this is the first time that this server has been started. Generating #a new UUID: 7be57493-e93a-11e8-aa59-107b447f9b4a. #2018-11-16T00:56:43.109000Z 0 [Warning] Gtid table is not ready to be used. Tabl #e 'mysql.gtid_executed' cannot be opened. #2018-11-16T00:56:45.403000Z 1 [Note] A temporary password is generated for root@ #localhost: s(CUYMY=o4VL # #D:\winApp\mysql-5.7.24-winx64\bin>mysqld --install #Service successfully installed. # #D:\winApp\mysql-5.7.24-winx64\bin>net start mysql #MySQL 服务正在启动 . #MySQL 服务已经启动成功。 # # #D:\winApp\mysql-5.7.24-winx64\bin>mysql -u root -p #Enter password: ************ #Welcome to the MySQL monitor. Commands end with ; or \g. #Your MySQL connection id is 7 #Server version: 5.7.24 # #Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved. # #Oracle is a registered trademark of Oracle Corporation and/or its #affiliates. Other names may be trademarks of their respective #owners. # #Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. # #mysql> set password=xuzhi; #ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that #corresponds to your MySQL server version for the right syntax to use near 'xuzhi #' at line 1 #mysql> set password='xuzhi'; #Query OK, 0 rows affected (0.00 sec)-----------------------------------------------------------------------------------------------------------------
mysql 数据库java连接超时
mysql -u root -p
Enter password: ***** Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 13 Server version: 5.7.24 MySQL Community Server (GPL)Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective owners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> use xcwork;
Database changed mysql> use mysql Database changed mysql> show tables -> ; +---------------------------+ | Tables_in_mysql | +---------------------------+ | columns_priv | | db | | engine_cost | | event | | func | | general_log | | gtid_executed | | help_category | | help_keyword | | help_relation | | help_topic | | innodb_index_stats | | innodb_table_stats | | ndb_binlog_index | | plugin | | proc | | procs_priv | | proxies_priv | | server_cost | | servers | | slave_master_info | | slave_relay_log_info | | slave_worker_info | | slow_log | | tables_priv | | time_zone | | time_zone_leap_second | | time_zone_name | | time_zone_transition | | time_zone_transition_type | | user | +---------------------------+ 31 rows in set (0.00 sec)mysql> select host from user;
+-----------+ | host | +-----------+ | localhost | | localhost | | localhost | +-----------+ 3 rows in set (0.00 sec)mysql> update user set host ='%' where user ='root';
Query OK, 1 row affected (0.00 sec) Rows matched: 1 Changed: 1 Warnings: 0mysql> select host from user;
+-----------+ | host | +-----------+ | % | | localhost | | localhost | +-----------+ 3 rows in set (0.00 sec)