一.初始化等 1.登陆数据库方法 mysql -u 用户名 -p 用户密码 2.修改root及用户密码 use mysql; update user set password=password('11111111') where user='root' and host='localhost'; flush privileges; MariaDB [mysql]> update user set password=password(') where user='root' and host…
一. 启动mysql:service mysql start 停止mysql:service mysql stop 重启mysql:service mysql restart 查看mysql服务状态:systemctl status mysqld.service 二. 登陆 mysql -u root -p 回车输入密码 mysql 显示所有的数据库,代码如下: mysql> show databases -> ;(注意加分号) mysql> show tables; 三.常用操作 1.…
1.显示数据库列表. show databases; 2.显示库中的数据表: use mysql; show tables; 3.显示数据表的结构: describe 表名; 4.建库: create database 库名; 5.建表: use 库名: create table 表名 (字段设定列表): 6.删库和删表: drop database 库名; drop table 表名: 7.将表中记录清空: delete from 表名; 8.显示表中的记录: select…