数据库操做经常使用命令

MariaDB对外开放链接:mysql

 

CREATE USER 'root'@'%' IDENTIFIED BY 'password'; GRANT ALL PRIVILEGES ON *.* TO 'root'@'%';
FLUSH PRIVILEGES;

 

 编辑/etc/mysql/my.cnfsql

#bind-address  = 127.0.0.1

mysql查看表结构命令,以下:

desc 表名;
show columns from 表名;
describe 表名;
show create table 表名;

use information_schema
select * from columns where table_name='表名';

顺便记下:
show databases;
use 数据库名;
show tables;

建立数据库
create database abc;
数据库

 

删除数据库:spa

DROP DATABASE 数据库名;code

 source 文件路径(注意要使用你所须要的数据库)orm

 

远程登录MySQL,同时指定对应的端口和ip。blog

假设远程的ip为:10.154.0.43ip

端口为:3341io

输入以下命令:table

#mysql -uroot -p -h10.154.0.43 -P3341

回车后:

会须要输入密码。

开放mysql的外部访问权限

 GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'mypassword' WITH GRANT OPTION

相关文章
相关标签/搜索