D:TestSoftwaremysql5731>cd bin
D:TestSoftwaremysql5731in>mysql -uroot -p
Enter password: ****
Welcome to the MySQL monitor. Commands end with ; or g.
Your MySQL connection id is 2
Server version: 5.7.31 MySQL Community Server (GPL)
Copyright (c) 2000, 2020, 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 mysql
Database changed
mysql> update user set host = '%' where user = 'root';
ERROR 1062 (23000): Duplicate entry '%-root' for key 'PRIMARY'
mysql> select host from user where user ='root'
-> select host from user where user ='root';
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 'select host from user where user ='root'' at line 2
mysql> select host from user where user ='root';
+-----------+
| host |
+-----------+
| % |
| 127.0.0.1 |
| localhost |
+-----------+
3 rows in set (0.01 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)
mysql> update user set password=PASSWORD("123456") where user='root';
ERROR 1054 (42S22): Unknown column 'password' in 'field list'
mysql>
mysql> update user set password=PASSWORD("123456") where user='root';
ERROR 1054 (42S22): Unknown column 'password' in 'field list'
mysql> update mysql.user set authentication_string=password('123456') where user='root';
Query OK, 3 rows affected, 1 warning (0.00 sec)
Rows matched: 3 Changed: 3 Warnings: 1
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> quit
Bye
MySQL错误“Specified key was too long; max key length is 1000 bytes”
mysql> SHOW ENGINES;
+--------------------+---------+----------------------------------------------------------------+--------------+------+------------+
| Engine | Support | Comment | Transactions | XA | Savepoints |
+--------------------+---------+----------------------------------------------------------------+--------------+------+------------+
| InnoDB | DEFAULT | Supports transactions, row-level locking, and foreign keys | YES | YES | YES |
| MRG_MYISAM | YES | Collection of identical MyISAM tables | NO | NO | NO |
| MEMORY | YES | Hash based, stored in memory, useful for temporary tables | NO | NO | NO |
| BLACKHOLE | YES | /dev/null storage engine (anything you write to it disappears) | NO | NO | NO |
| MyISAM | YES | MyISAM storage engine | NO | NO | NO |
| CSV | YES | CSV storage engine | NO | NO | NO |
| ARCHIVE | YES | Archive storage engine | NO | NO | NO |
| PERFORMANCE_SCHEMA | YES | Performance Schema | NO | NO | NO |
| FEDERATED | NO | Federated MySQL storage engine | NULL | NULL | NULL |
+--------------------+---------+----------------------------------------------------------------+--------------+------+------------+
9 rows in set (0.00 sec)
mysql> show variables like "have_%";
+------------------------+-------+
| Variable_name | Value |
+------------------------+-------+
| have_compress | YES |
| have_crypt | NO |
| have_dynamic_loading | YES |
| have_geometry | YES |
| have_openssl | YES |
| have_profiling | YES |
| have_query_cache | YES |
| have_rtree_keys | YES |
| have_ssl | YES |
| have_statement_timeout | YES |
| have_symlink | YES |
+------------------------+-------+
11 rows in set, 1 warning (0.00 sec)
mysql> set global innodb_large_prefix=1;
Query OK, 0 rows affected, 1 warning (0.00 sec)
mysql> set global innodb_file_format=BARRACUDA
-> set global innodb_file_format=BARRACUDA;
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 'set global innodb_file_format=BARRACUDA' at line 2
mysql> set global innodb_file_format_max=BARRACUDA;
Query OK, 0 rows affected, 1 warning (0.00 sec)
mysql> set global innodb_file_format=BARRACUDA;
Query OK, 0 rows affected, 1 warning (0.00 sec)