码迷,mamicode.com
首页 > 数据库 > 详细

Redhat7 安装mariadb(原mysql)

时间:2015-12-11 07:18:50      阅读:543      评论:0      收藏:0      [点我收藏+]

标签:mariadb

Redhat7 安装mariadb(原mysql)


安装:

# yuminstall mariadb mariadb-server

 

启动并开机启动:

#systemctl start mariadb

#systemctl enable mariadb

 

此时mysqlroot密码为空

# mysql –uroot

  • user mysql;

  • update user set password=password(‘123456’) where user=root;

  • flush privileges;

  • quit

 

开防火墙:

#firewall-cmd –permanent –add-service=mysql

#firewall-cmd --reload

 

 

# vi/etc/my.cnf  mysqld下)

 

Skip-networking= 1         (关闭远程通过ip进行连接,默认是允许的)

 

:wq

 

link 模糊查询

link ‘%a%’   中间含字母a

link ‘_a%’    a结尾的

link ‘%a_’    a开头的

 

语句示例(注意区分函数、字段、表名):

 

select *from worker where sal >= 2500;

select *from worker where sal != 2500;

 

select*from worker where deptno in(2,4);

 

select *from worker where sal between 1500 and 2500;

 

selectavg(sal) from worker;

selectmax(sal) from worker;

selectmin(sal) from worker;

 

select *from worker order by deptno;   (升序排列)

select *from worker order by deptno desc;  (降序排列)

 

selectdeptno,max(sal) from worker group by deptno;

 

 

createtable test as select * from worker;

 

内连接:

selectstudent,sno,student.sname,coll.cname from student join coll onstudent.cno=coll.con;

 

左外连接:

select s.sno,s.sname,c.cnamefrom student as s left join coll as c on s.cno=c.cno;

 

右连接:

select s.sno,s.sname,c.cnamefrom coll as c right join student as s on s.cno=c.cno;

 


本文出自 “linux” 博客,请务必保留此出处http://yangzhiming.blog.51cto.com/4849999/1721717

Redhat7 安装mariadb(原mysql)

标签:mariadb

原文地址:http://yangzhiming.blog.51cto.com/4849999/1721717

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!