目录
MySQL安装
基本命令
MySQL安装
先去官网社区下载个安装包,我们下载下来离线安装(2.3M 的是在线安装):
直接点击 (no thanks,just start my download 不用了,谢谢,开始下载就好 )MySQL安装包https://dev.mysql.com/downloads/file/?id=511553
然后我们自定义安装一下,默认安装的话它就装在c盘里了:打开安装包 → 选择第五项 → 点击下一步(next)
然后我们把安装包导过来:点击mysql servers下的mysql server下的mysql server 8.0 然后选中下面的复选框(Enable the select features page to customize product features)
然后点击文件 mysql server 8.0.29 -x64 ,下方会出现 Advanced Options ,点击就可以自定义安装路径
然后直接下一步下一步就好了:下一步(next)→ 点击 execute →到 密码验证方式(Authentication Method)时选择第二项 → 然后下一步设置一下密码:
然后还是下一步下一步,finish就好了
然后我们再链接一下数据库,开始栏搜索一下MySQL,点击MySQL installer- community
点击 reconfigure,然后下一步下一步,输入你刚才设置的密码检查一下
然后下一步下一步,finish
好,那我们就安装好啦,我们来打开MySQL测试一下是否安装成功,这次就点击MySQL 8.0 command line
输入密码,show 一下 databases,MySQL默认自带四个数据库
基本命令show databases;//查看mysql中有哪些数据库,”分号结尾“ 以下命令都不区分大小写
mysql> show databases; // +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | performance_schema | | sys | +--------------------+ 4 rows in set (0.00 sec)
use 数据库名;//使用某个数据库
mysql> use sys; // Database changed
create databases 数据库名; //创建一个数据库
mysql> create database china; // Query OK, 1 row affected (0.01 sec) mysql> show databases; // +--------------------+ | Database | +--------------------+ | china | | information_schema | | mysql | | performance_schema | | sys | +--------------------+ 5 rows in set (0.00 sec)
show tables ;//查看数据库下有哪些表
mysql> use sys; // Database changed mysql> show tables; // +-----------------------------------------------+ | Tables_in_sys | +-----------------------------------------------+ | host_summary | | host_summary_by_file_io | | host_summary_by_file_io_type | | host_summary_by_stages | | host_summary_by_statement_latency | | host_summary_by_statement_type | | innodb_buffer_stats_by_schema | | innodb_buffer_stats_by_table | | innodb_lock_waits | | io_by_thread_by_latency | | io_global_by_file_by_bytes | | io_global_by_file_by_latency | | io_global_by_wait_by_bytes | | io_global_by_wait_by_latency | | latest_file_io | | memory_by_host_by_current_bytes | | memory_by_thread_by_current_bytes | | memory_by_user_by_current_bytes | | memory_global_by_current_bytes | | memory_global_total | | metrics | | processlist | | ps_check_lost_instrumentation | | schema_auto_increment_columns | | schema_index_statistics | | schema_object_overview | | schema_redundant_indexes | | schema_table_lock_waits | | schema_table_statistics | | schema_table_statistics_with_buffer | | schema_tables_with_full_table_scans | | schema_unused_indexes | | session | | session_ssl_status | | statement_analysis | | statements_with_errors_or_warnings | | statements_with_full_table_scans | | statements_with_runtimes_in_95th_percentile | | statements_with_sorting | | statements_with_temp_tables | | sys_config | | user_summary | | user_summary_by_file_io | | user_summary_by_file_io_type | | user_summary_by_stages | | user_summary_by_statement_latency | | user_summary_by_statement_type | | version | | wait_classes_global_by_avg_latency | | wait_classes_global_by_latency | | waits_by_host_by_latency | | waits_by_user_by_latency | | waits_global_by_latency | | x$host_summary | | x$host_summary_by_file_io | | x$host_summary_by_file_io_type | | x$host_summary_by_stages | | x$host_summary_by_statement_latency | | x$host_summary_by_statement_type | | x$innodb_buffer_stats_by_schema | | x$innodb_buffer_stats_by_table | | x$innodb_lock_waits | | x$io_by_thread_by_latency | | x$io_global_by_file_by_bytes | | x$io_global_by_file_by_latency | | x$io_global_by_wait_by_bytes | | x$io_global_by_wait_by_latency | | x$latest_file_io | | x$memory_by_host_by_current_bytes | | x$memory_by_thread_by_current_bytes | | x$memory_by_user_by_current_bytes | | x$memory_global_by_current_bytes | | x$memory_global_total | | x$processlist | | x$ps_digest_95th_percentile_by_avg_us | | x$ps_digest_avg_latency_distribution | | x$ps_schema_table_statistics_io | | x$schema_flattened_keys | | x$schema_index_statistics | | x$schema_table_lock_waits | | x$schema_table_statistics | | x$schema_table_statistics_with_buffer | | x$schema_tables_with_full_table_scans | | x$session | | x$statement_analysis | | x$statements_with_errors_or_warnings | | x$statements_with_full_table_scans | | x$statements_with_runtimes_in_95th_percentile | | x$statements_with_sorting | | x$statements_with_temp_tables | | x$user_summary | | x$user_summary_by_file_io | | x$user_summary_by_file_io_type | | x$user_summary_by_stages | | x$user_summary_by_statement_latency | | x$user_summary_by_statement_type | | x$wait_classes_global_by_avg_latency | | x$wait_classes_global_by_latency | | x$waits_by_host_by_latency | | x$waits_by_user_by_latency | | x$waits_global_by_latency | +-----------------------------------------------+ 101 rows in set (0.00 sec)
exit //退出mysql ,没有分号



