centos6.5 yum安装mysql_CentOS 6.5使用yum安装MySQL快速上手必备
CentOS 6.5使用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即可
總結
以上是生活随笔為你收集整理的centos6.5 yum安装mysql_CentOS 6.5使用yum安装MySQL快速上手必备的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 铝机箱十大品牌排行榜
- 下一篇: linux cmake编译源码,linu