centos6.9使用yum安裝mysql(簡單粗暴,親測有效)


第1步、yum安裝mysql
[root@stonex ~]#  yum -y install mysql-server
安裝結果:
Installed:
    mysql-server.x86_64 0:5.1.73-3.el6_5                                                                                                                                                         
Dependency Installed:
    mysql.x86_64 0:5.1.73-3.el6_5                                perl-DBD-MySQL.x86_64 0:4.013-3.el6                                perl-DBI.x86_64 0:1.609-4.el6

第2步、設置開機啟動
[root@stonex ~]#  chkconfig mysqld on

第3步、啟動MySql服務
[root@stonex ~]#  service mysqld start

第4步、設置MySQL的root用戶設置密碼
[root@stonex ~]#  mysql -u root
Welcome to the MySQL monitor.  Commands end with ; or \g.
...... 省略了一些行
mysql> select user,host,password from mysql.user;
查詢用戶的密碼,都為空,用下面的命令設置root的密碼為root
mysql> set password for root@localhost=password('root');
mysql> exit

第5步、用新密碼登陸
[root@stonex ~]#  mysql -u root -p

第6步、基本命令
show databases; //查看系統已存在的數據庫
use databasesname;   //選擇需要使用的數據庫
drop database databasename; //刪除選定的數據庫
exit    //退出數據庫的連接
create database test01;    //建立名為test的數據庫
show tables;        // 列出當前數據庫下的表
其他基本的增刪改查使用標准SQL即可

第7步、開放遠程登錄權限

GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'root' WITH GRANT OPTION;
FLUSH PRIVILEGES;

(完)
本文轉載自:http://blog.csdn.net/xxd851116/article/details/22947891


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM