CentOS6.5安装MySQL5.1.73数据库

一、描述

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

二、主要步骤

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

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

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

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

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

[tong@tong tongSoftware]$ rpm -qa | grep mysqlmysql-server-5.1.73-3.el6_5.x86_64mysql-5.1.73-3.el6_5.x86_64mysql-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 startPlease report any problems with the /usr/bin/mysqlbug script![ OK ]Starting mysqld: [ OK ]

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

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

mysql>

6、输入exit退出数据库

mysql> exitBye

7、配置初始root密码

[tong@tong tongSoftware]$ sudo mysqladmin -u root passwordAdmin123

格式;mysqladmin -u 用户 password 密码

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

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

9、修改用户密码

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

Enter password:

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

这一秒不放弃,下一秒就会有希望。

CentOS6.5安装MySQL5.1.73数据库

相关文章:

你感兴趣的文章:

标签云: