《RHEL6下mysql的搭建》

王朝学院·作者佚名  2016-05-27
窄屏简体版  字體: 小  |  中  |  大  |  超大  

《RHEL6下MySQL的搭建》mysql ==========

yum install mysql mysql-server

mysqladmin -uroot -PRedhat passWord westos修改本地mysql root密码

mysqladmin -uroot -predhat -h 192.168.0.188 password westos修改远程192.168.0.188 mysql服务器 root密码

mysql_secure_installation第一次安装mysql以后通过这条命令可以对mysql进行设置

mysql -uroot -predhat从本机登录mysql数据库

show databases;显示数据库

use mysql;进入数据库

show tables;显示数据库中的表

desc user;查看user表的数据结构

flush privileges;刷新数据库信息

select host.user,password from user;查询user表中的host,user,password字段

create database westos;创建westos数据库

use westos; create table linux(创建表,username,password字段 username varchar(15) not null, password varchar(15) not null );

select * from mysql.user;查询mysql库下的user表中的所以

show tables; desc linux;

insert into linux values ('user1','passwd1');在linux表中插入值为username = user1,password = password1

update linux set password=password('passwd2') where username=user1;更新linux表中user1 的密码为password2

delete from linux where username='user1';删除linux表中user1的所以内容

grant select on *.* to user1@localhost identified by 'passwd1';授权user1 密码为passwd1 并且只能在本地 查询数据库的所以内容

grant all on mysql.* to user2@'%' identified by 'passwd2';授权user2 密码为passwd2 可以从远程任意主机登录mysql 并且可以对mysql数据库任意操作

备份 /var/lib/mysql mysqldump -uroot -predhat mysql > mysql.bak备份mysql库到mysql.bak

mysql -uroot -predhat westos < mysql.bak恢复mysql.bak 到westos库

mysql 密码恢复 /etc/init.d/mysqld stop

mysqld_safe --skip-grant-tables &跳过grant-tables授权表 不需要认证登录本地mysql数据库

update mysql.user set Password=password('westos') where User='root';更新mysql.user 表中条件为root用户的密码为加密westos

/etc/init.d/mysql restart

phpmyadmin yum install php php-mysql httpd mysql mysql-server

tar jxf phpmyadmin-*.tar.bz2 -C /var/www/html mv phpmyadmin phpadmin cp config.sample.inc.php config.inc.php vim config.inc.php add $cfg['blowfish_secret'] = 'test';

/etc/init.d/httpd start http://192.168.0.188/phpadmin

 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
© 2005- 王朝網路 版權所有 導航