进入mysql命令
1.进入根目录:
su
2.输入用户密码
3.进入mysql数据库
mysql
如下:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 15
Server version: 5.7.27-0ubuntu0.18.04.1 (Ubuntu)
Copyright (c) 2000, 2019, 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>
数据库的增删查:
查看数据库:show databases;
创建数据库: create database name;
使用数据库: use name;
删除数据库: drop database name;
设置数据库编码: set names utf8;
基本表的增删查:
show tables;查看数据库中的表
use name 使用表
desc table_name;查看表结构
desc name;查看表结构
drop table name;删除表
mysql中的中文乱码问题的解决:
对于mysql中出现的中文乱码问题,我没有修改mysql的配置文件,而是直接在建表时设置charset为uft8。default charset=uft8;