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