centos7从外部无法连接,iptables无限制。
http://stackoverflow.com/questions/16161889/cant-connect-to-remote-mysql-server-with-error-61
sudo firewall-cmd --zone=public --permanent --add-service=mysql
sudo systemctl restart firewalld
查看用户
select Host,User,Password from mysql.user;
SHOW 指令(‘[..]'里的可选)
show databases; #显示mysql中所有数据库的名称
show tables [ from db_name] #显示mysql中的相关表
show full fields from tbl_name #列出表字段完整属性
show columns from table_name [ from database_name ] ; 或show columns from database_name.table_name; #显示表中列名称
show grants for user_name; #显示一个用户的权限,显示结果类似于grant 命令
show index from tbl_name #列出表索引
show index from table_name #显示表的索引
添加用户
CREATE USER 'john'@'192.168.189.71' IDENTIFIED BY "123";
grant all privileges on *.* to joe@localhost identified by '1';
flush privileges;
mysql移动到别的目录下
vim /etc/my.cnf
修改列名表名
alter table test rename test1; --修改表名
alter table test add column name varchar(10); --添加表列
alter table test drop column name; --删除表列
alter table test modify address char(10) --修改表列类型
alter table test change address address char(40)
alter table test change column address address1 varchar(30)--修改表列名
为什么不能不带类型的修改表名简直不合理!
视图
create view 视图名称[(column_list)] as select语句
create view province_view as select * from province;
select * from province_view;
类型转换
inet_ntoa(sa) 将int型ip转换为字符
时间转换