CentOS6.5安装MySQL5.1.73数据库

一、描述

本博客主要介绍CentOS6.5安装MySQL数据库 、启动和关闭MySQL服务、MySQL的登录和退出,以及My SQL数据库root用户的密码配置和修改。

二、主要步骤

1、查看本系统是否已经安装有MySQL数据库

先查看本操作系统是否已经安装有操作系统,显示只有一个mysql的类库,并没有安装该数据库。

[tong@tong tongSoftware]$ rpm -qa | grep mysql
mysql-libs-5.1.73-3.el6_5.x86_64

2、使用yum安装MySQL数据库,需要安装mysql客户端和mysql-server

[tong@tong tongSoftware]$ sudo yum install mysql mysql-server
3、查看已安装数据库 ,显示安装完毕的数据库

[tong@tong tongSoftware]$ rpm -qa | grep mysql
mysql-server-5.1.73-3.el6_5.x86_64
mysql-5.1.73-3.el6_5.x86_64
mysql-libs-5.1.73-3.el6_5.x86_64

4、查看数据库的启动状态,如果未启动则启动MySQL数据库

[tong@tong tongSoftware]$ sudo service mysqld status
[sudo] password for tong: 
mysqld is stopped
[tong@tong tongSoftware]$ sudo service mysqld start
Please report any problems with the /usr/bin/mysqlbug script!
[  OK  ]
Starting mysqld:  [  OK  ]

5、默认无密码以root用户登录数据库

[tong@tong tongSoftware]$ mysql -u root
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.1.73 Source distribution
Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved
......

mysql> 

6、输入exit退出数据库

mysql> exit
Bye

7、配置初始root密码

[tong@tong tongSoftware]$ sudo mysqladmin -u root password Admin123

格式;mysqladmin -u 用户 password  密码

8、root用户使用密码登录数据库

[tong@tong tongSoftware]$ sudo mysql -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 6
Server version: 5.1.73 Source distribution

9、修改用户密码

[tong@tong tongSoftware]$ sudo mysqladmin -u root -p password Admin

Enter password:

格式:mysqladmin -u 用户  -p password  密码

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值