安装前,先卸载mysql
yum方式安装的MySQL
1、yum remove mysql mysql-server mysql-libs compat-mysql51
2、rm -rf /var/lib/mysql3、rm /etc/my.cnf
查看是否还有mysql软件:如果存在的话,继续删除即可。
rpm方式安装的mysql
a)查看系统中是否以rpm包安装的mysql:
[root@localhost opt]# rpm -qa | grep -i mysql
b)卸载mysql
[root@localhost local]# rpm -e MySQL-server-5.6.17-1.el6.i686
[root@localhost local]# rpm -e MySQL-client-5.6.17-1.el6.i686
c)删除mysql服务
[root@localhost local]# chkconfig --list | grep -i mysql
[root@localhost local]# chkconfig --del mysql
d)删除分散mysql文件夹
[root@localhost local]# whereis mysql 或者 find / -name mysql
mysql: /usr/lib/mysql /usr/share/mysql
清空相关mysql的所有目录以及文件
rm -rf /usr/lib/mysql
rm -rf /usr/share/mysql
rm -rf /usr/my.cnf
通过以上几步,mysql应该已经完全卸载干净了
卸载干净后就可以安装了
MariaDB数据库管理系统是MySQL的一个分支,主要由开源社区在维护,采用GPL授权许可。开发这个分支的原因之一是:甲骨文公司收购了MySQL后,有将MySQL闭源的潜在风险,因此社区采用分支的方式来避开这个风险。MariaDB的目的是完全兼容MySQL,包括API和命令行,使之能轻松成为MySQL的代替品。
安装mariadb,大小59 M。
[root@yl-web yl]# yum install mariadb-server mariadb
mariadb数据库的相关命令是:
systemctl start mariadb #启动MariaDB
systemctl stop mariadb #停止MariaDB
systemctl restart mariadb #重启MariaDB
systemctl enable mariadb #设置开机启动
所以先启动数据库
[root@yl-web yl]# systemctl start mariadb
然后就可以正常使用mysql了
设置密码
[root@localhost Desktop]# systemctl start mariadb
[root@localhost Desktop]# mysqladmin -u root password '123456'
[root@localhost Desktop]# mysql -u root -p
MySQL 授权远程访问(先用 root 登录 mysql)
mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456' WITH
GRANT OPTION;
mysql> FLUSH PRIVILEGES;
为了方便远程管理,防火墙中打开 3306 端口
# vi /etc/sysconfig/iptables
-A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT
[root@yl-web yl]# mysql -u root -p Enter password: Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 3 Server version: 5.5.41-MariaDB MariaDB Server Copyright (c) 2000, 2014, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [(none)]> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | performance_schema | | test | +--------------------+ 4 rows in set (0.00 sec) MariaDB [(none)]>
/*==============================================================*/
/* DBMS name: MySQL 5.0 */
/* Created on: 2013/1/16 14:32:28 */
/*==============================================================*/
/*==============================================================*/
/* Table: i18n */
/*==============================================================*/
create table i18n
(
lang varchar(20) not null,
id varchar(200) not null,
lbl varchar(200) not null,
primary key (lang, id)
);
/*==============================================================*/
/* Table: pj */
/*==============================================================*/
create table pj
(
pj varchar(50) not null,
path varchar(200) not null,
url varchar(200) not null,
type varchar(10) not null,
des varchar(200),
primary key (pj)
);
/*==============================================================*/
/* Table: pj_gr */
/*==============================================================*/
create table pj_gr
(
pj varchar(50) not null,
gr varchar(50) not null,
des varchar(100),
primary key (pj, gr)
);
/*==============================================================*/
/* Table: pj_gr_auth */
/*==============================================================*/
create table pj_gr_auth
(
pj varchar(50) not null,
gr varchar(50) not null,
res varchar(200) not null,
rw varchar(10),
primary key (pj, res, gr)
);
/*==============================================================*/
/* Table: pj_gr_usr */
/*==============================================================*/
create table pj_gr_usr
(
pj varchar(50) not null,
gr varchar(50) not null,
usr varchar(50) not null,
primary key (pj, usr, gr)
);
/*==============================================================*/
/* Table: pj_usr */
/*==============================================================*/
create table pj_usr
(
pj varchar(50) not null,
usr varchar(50) not null,
psw varchar(50) not null,
primary key (usr, pj)
);
/*==============================================================*/
/* Table: pj_usr_auth */
/*==============================================================*/
create table pj_usr_auth
(
pj varchar(50) not null,
usr varchar(50) not null,
res varchar(200) not null,
rw varchar(10),
primary key (pj, res, usr)
);
/*==============================================================*/
/* Table: usr */
/*==============================================================*/
create table usr
(
usr varchar(50) not null,
psw varchar(50) not null,
role varchar(10),
primary key (usr)
);
alter table pj_gr add constraint FK_Relationship_2 foreign key (pj)
references pj (pj) on delete restrict on update restrict;
alter table pj_gr_auth add constraint FK_Reference_6 foreign key (pj, gr)
references pj_gr (pj, gr) on delete restrict on update restrict;
alter table pj_gr_usr add constraint FK_Reference_10 foreign key (pj, gr)
references pj_gr (pj, gr) on delete restrict on update restrict;
alter table pj_gr_usr add constraint FK_Reference_9 foreign key (usr)
references usr (usr) on delete restrict on update restrict;
alter table pj_usr add constraint FK_Reference_5 foreign key (pj)
references pj (pj) on delete restrict on update restrict;
alter table pj_usr add constraint FK_Reference_7 foreign key (usr)
references usr (usr) on delete restrict on update restrict;
alter table pj_usr_auth add constraint FK_Reference_11 foreign key (pj)
references pj (pj) on delete restrict on update restrict;
alter table pj_usr_auth add constraint FK_Reference_8 foreign key (usr)
references usr (usr) on delete restrict on update restrict;
insert into i18n (lang,id,lbl) values ('en','en','English'); insert into i18n (lang,id,lbl) values ('en','i18n.add.title','Add Language'); insert into i18n (lang,id,lbl) values ('en','i18n.current','Current Language'); insert into i18n (lang,id,lbl) values ('en','i18n.error.lang','[Language] cannot be empty'); insert into i18n (lang,id,lbl) values ('en','i18n.error.lbl','[Label] cannot be empty'); insert into i18n (lang,id,lbl) values ('en','i18n.id','Key'); insert into i18n (lang,id,lbl) values ('en','i18n.lang','Language'); insert into i18n (lang,id,lbl) values ('en','i18n.lbl','Label'); insert into i18n (lang,id,lbl) values ('en','i18n.op.addlang','Add Language'); insert into i18n (lang,id,lbl) values ('en','i18n.op.export','Export Language'); insert into i18n (lang,id,lbl) values ('en','i18n.op.submit','Submit'); insert into i18n (lang,id,lbl) values ('en','i18n.title','Language'); insert into i18n (lang,id,lbl) values ('en','login.btn.login','Login'); insert into i18n (lang,id,lbl) values ('en','login.info.setadmin','Welcome to SVN ADMIN,please set the administrator accout and password.'); insert into i18n (lang,id,lbl) values ('en','login.title','SVN ADMIN Login'); insert into i18n (lang,id,lbl) values ('en','main.link.i18n','Language'); insert into i18n (lang,id,lbl) values ('en','main.link.logout','Logout'); insert into i18n (lang,id,lbl) values ('en','main.link.pj','Project'); insert into i18n (lang,id,lbl) values ('en','main.link.user','User'); insert into i18n (lang,id,lbl) values ('en','main.title','SVN ADMIN'); insert into i18n (lang,id,lbl) values ('en','pj.btn.submit','Submit'); insert into i18n (lang,id,lbl) values ('en','pj.des','Desciption'); insert into i18n (lang,id,lbl) values ('en','pj.error.path','[Path] cannot be empty'); insert into i18n (lang,id,lbl) values ('en','pj.error.pj','[Project] cannot be empty'); insert into i18n (lang,id,lbl) values ('en','pj.error.url','[URL] cannot be empty'); insert into i18n (lang,id,lbl) values ('en','pj.op.delete','Delete'); insert into i18n (lang,id,lbl) values ('en','pj.op.delete.confirm','Are you sure to delete?'); insert into i18n (lang,id,lbl) values ('en','pj.op.setauth','Authorization'); insert into i18n (lang,id,lbl) values ('en','pj.op.setgr','Group'); insert into i18n (lang,id,lbl) values ('en','pj.op.setuser','User'); insert into i18n (lang,id,lbl) values ('en','pj.path','Path'); insert into i18n (lang,id,lbl) values ('en','pj.pj','Project'); insert into i18n (lang,id,lbl) values ('en','pj.title','Project'); insert into i18n (lang,id,lbl) values ('en','pj.type','Type'); insert into i18n (lang,id,lbl) values ('en','pj.type.http','http'); insert into i18n (lang,id,lbl) values ('en','pj.type.http.mutil','http(mutil)'); insert into i18n (lang,id,lbl) values ('en','pj.type.svn','svn'); insert into i18n (lang,id,lbl) values ('en','pj.url','URL'); insert into i18n (lang,id,lbl) values ('en','pjauth.btn.submit','Save'); insert into i18n (lang,id,lbl) values ('en','pjauth.error.grusr','Please select Group or User'); insert into i18n (lang,id,lbl) values ('en','pjauth.error.pj','[Project] cannot be empty'); insert into i18n (lang,id,lbl) values ('en','pjauth.error.res','[Resource] can not be empy'); insert into i18n (lang,id,lbl) values ('en','pjauth.op.delete','Delete'); insert into i18n (lang,id,lbl) values ('en','pjauth.op.delete.confirm','Are you sure to delete?'); insert into i18n (lang,id,lbl) values ('en','pjauth.res','Resource'); insert into i18n (lang,id,lbl) values ('en','pjauth.res.select','Please select resource'); insert into i18n (lang,id,lbl) values ('en','pjauth.rw','Access'); insert into i18n (lang,id,lbl) values ('en','pjauth.rw.none','none'); insert into i18n (lang,id,lbl) values ('en','pjauth.rw.r','Read'); insert into i18n (lang,id,lbl) values ('en','pjauth.rw.rw','Read-write'); insert into i18n (lang,id,lbl) values ('en','pjauth.title','Authorization'); insert into i18n (lang,id,lbl) values ('en','pjgr.btn.submit','Submit'); insert into i18n (lang,id,lbl) values ('en','pjgr.error.gr','[Group] cannot be empty'); insert into i18n (lang,id,lbl) values ('en','pjgr.error.pj','[Project] cannot be empty'); insert into i18n (lang,id,lbl) values ('en','pjgr.op.delete','Delete'); insert into i18n (lang,id,lbl) values ('en','pjgr.op.delete.confirm','Are you sure to delete?'); insert into i18n (lang,id,lbl) values ('en','pjgr.op.setuser','User'); insert into i18n (lang,id,lbl) values ('en','pjgr.title','Groups'); insert into i18n (lang,id,lbl) values ('en','pjgrusr.error.usr','[User] cannot be empty'); insert into i18n (lang,id,lbl) values ('en','pjgrusr.op.delete','Delete'); insert into i18n (lang,id,lbl) values ('en','pjgrusr.op.delete.confirm','Are you sure to delete?'); insert into i18n (lang,id,lbl) values ('en','pjgrusr.op.submit','Add User'); insert into i18n (lang,id,lbl) values ('en','pjgrusr.title','Group User'); insert into i18n (lang,id,lbl) values ('en','pjusr.error.pj','[Project] cannot be empty'); insert into i18n (lang,id,lbl) values ('en','pjusr.error.psw','[Password] cannot be empty'); insert into i18n (lang,id,lbl) values ('en','pjusr.error.usr','[User] cannot be empty'); insert into i18n (lang,id,lbl) values ('en','pjusr.info','(Notice:Project user setting only effect this project)'); insert into i18n (lang,id,lbl) values ('en','pjusr.op.delete','Delete'); insert into i18n (lang,id,lbl) values ('en','pjusr.op.submit','Submit'); insert into i18n (lang,id,lbl) values ('en','pjusr.psw.psw','Password'); insert into i18n (lang,id,lbl) values ('en','pjusr.title','Project User'); insert into i18n (lang,id,lbl) values ('en','pjusr.usr.select','Please select user'); insert into i18n (lang,id,lbl) values ('en','pj_gr.des','Desciption'); insert into i18n (lang,id,lbl) values ('en','pj_gr.gr','Group'); insert into i18n (lang,id,lbl) values ('en','rep.btn.go','Refresh'); insert into i18n (lang,id,lbl) values ('en','svn.auth.error','authorization failed'); insert into i18n (lang,id,lbl) values ('en','sys.error','Error:'); insert into i18n (lang,id,lbl) values ('en','sys.error.pj.empty','Can not access'); insert into i18n (lang,id,lbl) values ('en','sys.error.timeout','Session has been timeout,please login again.'); insert into i18n (lang,id,lbl) values ('en','sys.lbl.no','No.'); insert into i18n (lang,id,lbl) values ('en','usr.error.psw','[Password] cannot be empty'); insert into i18n (lang,id,lbl) values ('en','usr.error.usr','[User] cannot be empty'); insert into i18n (lang,id,lbl) values ('en','usr.op.delete','Delete'); insert into i18n (lang,id,lbl) values ('en','usr.op.delete.confirm','Are you sure to delete?'); insert into i18n (lang,id,lbl) values ('en','usr.op.submit','Submit'); insert into i18n (lang,id,lbl) values ('en','usr.psw','Password'); insert into i18n (lang,id,lbl) values ('en','usr.role','Role'); insert into i18n (lang,id,lbl) values ('en','usr.role.select','Please select role'); insert into i18n (lang,id,lbl) values ('en','usr.title','User'); insert into i18n (lang,id,lbl) values ('en','usr.usr','User'); insert into i18n (lang,id,lbl) values ('en','zh_CN','Simplified Chinese');
启动 svnadmin-tomcat
# /root/svnadmin-tomcat/bin/startup.sh
浏览器中打开:http://localhost:8080/svnadmin/
此时:
/svn/目录下会创建一个 wusc_edu 的 SVN 库目录。
同 时 也 会 多 出 一 个 httpd.conf 文 件 , 内 容 与 subversion.conf 一 样 , 在
/etc/httpd/conf.d/subversion.conf 中已配置。
/svn/authz 授权文件中会多出如下内容:
[aliases]
[groups]
wusc_edu_developer=
wusc_edu_manager=
wusc_edu_tester=
[wusc_edu:/]
@wusc_edu_manager=rw
以上过程其实是调用了 svn 对应的命令做了相应的操作
配置库目录权限
# cd /svn
# chown -R apache.apache wusc_edu
# chmod -R 777 wusc_edu
(如创建新库,需要对新建的库目录执行以上两步授权操作)
关闭 SELinux(Linux 的访问控制)
修改/etc/selinux/config 文件
# vi /etc/selinux/config
将 SELINUX=enforcing 改为 SELINUX=disabled
重启机器即可
# reboot