yum install mysql
yum install mysql-server
yum install mysql-devel
chgrp -R mysql /var/lib/mysql
chmod -R 770 /var/lib/mysql
service mysqld start
修改root的密碼
mysqladmin -u root password 'newpassword' 更改密碼
mysql -u root -p 登錄數據庫
mysql> DROP DATABASE test; 刪除test數據庫
mysql> DELETE FROM mysql.user WHERE user = ''; 刪除匿名帳戶
mysql> FLUSH PRIVILEGES; 重載權限
添加mysql用戶:GRANT ALL PRIVILEGES ON my_db.* TO 'user'@'localhost' IDENTIFIED BY 'password';
# sudo service mysqld restart 重啟服務
# sudo service mysqld stop 關閉服務 www.2cto.com
/etc/rc.d/init.d/mysqld status 查看mysql狀態
# sudo chkconfig --del mysqld 刪除服務清單中mysql服務
chkconfig --list 察看mysql是否在自動啟動列表中
#sudo /etc/init.d/mysqld start 啟動mysql服務
#sudo /etc/init.d/mysqld stop 關閉mysql服務
#sudo /etc/init.d/mysqld restart 重啟mysql服務
/usr/bin/mysqladmin -u root -p'password' shutdown關閉mysql服務
作者 Sharpleo