你好,游客 登录 注册 搜索
背景:
阅读新闻

CentOS 6.5使用yum安装MySQL快速上手必备

[日期:2014-04-05] 来源:Linux社区  作者:xxd851116 [字体:大 中 小]

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即可

更多CentOS相关信息见CentOS 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=14

linux
相关资讯       CentOS 6.5  CentOS 6.5安装MySQL 
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款