宝塔linux面板

进入数据库命令
mysql -uroot -p

查看当前数据库中用户的权限是否支持远程访问支持的是‘%’
SELECT User, Host FROM mysql.user;

设置用户权限为允许远程访问
grant all privileges on *.* to 'root'@'%' identified by '12345678' with grant option;

刷新
flush privileges;

 

 

 

 

本章演示纯手工不借助任何工具在以命令行的方式运行操作mysql:

1.进入mysql、其中root是这个mysql的用户名一般如果不改动默认是root,密码不改动也默认是root:

  mysql -u root -p 回车

  数据库密码

MySql-基础(1)

2.查看当前数据库中都有哪些表: show databases;

MySql-基础(1)

3.创建数据库:create database 数据库名;

MySql-基础(1)

4.删除数据库:drop database 数据库名;

MySql-基础(1)

5.进入数据库:use 数据库名;

MySql-基础(1)

6.创建表:create table 表名(id int(10) auto_increment, name char(255), primary key(id)) default charset=utf8

MySql-基础(1)

7.查看数据库有多少张表:show tables;

MySql-基础(1)

8.查看表结构:desc 表名

MySql-基础(1)

9.删除表:drop table 表名

MySql-基础(1)

 10.在数据库中执行sql脚本

mysql> source D:\code\xxl-job\doc\db\tables_xxl_job.sql

  其中source是命令关键字

MySql-基础(1)

 

相关文章:

  • 2021-08-26
  • 2021-09-19
  • 2022-12-23
  • 2021-12-05
  • 2021-04-15
  • 2021-12-10
  • 2021-05-17
  • 2021-11-28
猜你喜欢
  • 2021-12-10
  • 2021-10-29
  • 2021-04-25
  • 2021-05-05
  • 2021-06-21
  • 2021-11-12
  • 2021-09-21
相关资源
相似解决方案