Home > Database > Mysql Tutorial > CentOS 6.5 环境安装 MySQL 5.1

CentOS 6.5 环境安装 MySQL 5.1

PHPz
Release: 2019-02-26 16:58:02
Original
1326 people have browsed it

CentOS 6.5 环境安装 MySQL 5.1

相关mysql视频教程推荐:《mysql教程

【环境介绍】

操作系统:     CentOS 6.5 i686 i386

MySQL版本: MySQL-community-5.1.73-1.rhel5.i386.rpm-bundle.tar

【安装步骤】

1、创建mysql用户和组

# groupadd mysql # useradd -g mysql mysql 

2、解压安装包

#进入安装包目录

$ cd /Software/MySQL_Install
$ tar -xvf MySQL-community-5.1.73-1.rhel5.i386.rpm-bundle.tar#
Copy after login

解压后有很多包,基本安装只需server和client包

$ ls -l-rwxr--r--. 1 mysql mysql   7583249 Nov  9  2013 MySQL-client-community-5.1.73-1.rhel5.i386.rpm-rw-r--r--. 1 mysql mysql 158781440 May 19 11:19 MySQL-community-5.1.73-1.rhel5.i386.rpm-bundle.tar-rwxr--r--. 1 mysql mysql  65728353 Nov  9  2013 MySQL-community-debuginfo-5.1.73-1.rhel5.i386.rpm-rwxr--r--. 1 mysql mysql  11305883 Nov  9  2013 MySQL-devel-community-5.1.73-1.rhel5.i386.rpm-rwxr--r--. 1 mysql mysql  32842715 Nov  9  2013 MySQL-embedded-community-5.1.73-1.rhel5.i386.rpm-rwxr--r--. 1 mysql mysql  20810122 Nov  9  2013 MySQL-server-community-5.1.73-1.rhel5.i386.rpm-rwxr--r--. 1 mysql mysql   1931288 Nov  9  2013 MySQL-shared-community-5.1.73-1.rhel5.i386.rpm-rwxr--r--. 1 mysql mysql   3260831 Nov  9  2013 MySQL-shared-compat-5.1.73-1.rhel5.i386.rpm-rwxr--r--. 1 mysql mysql  15310916 Nov  9  2013 MySQL-test-community-5.1.73-1.rhel5.i386.rpm
Copy after login

3、安装server、client包

# rpm -ivh MySQL-server-community-5.1.73-1.rhel5.i386.rpm
# rpm -ivh MySQL-client-community-5.1.73-1.rhel5.i386.rpm
Copy after login

这里是默认安装,,安装后的目录:

数据库目录

    /var/lib/mysql/ (包含mysql、test数据库)
Copy after login

配置文件

     /usr/share/mysql (mysql.server命令及配置文件)
Copy after login

相关命令

     /usr/bin (mysqladmin mysqldump等命令)
Copy after login

启动脚本

     /etc/rc.d/init.d/ (启动脚本文件mysql的目录)
Copy after login

4、用mysqladmin工具查看安装是否成功

# mysqladmin --version
mysqladmin  Ver 8.42 Distrib 5.1.73, for pc-linux-gnu on i686
Copy after login

5、修改mysql的root用户密码

# mysqladmin -u root password
Copy after login

6、停掉mysql服务

# service mysql stop
Copy after login

或者

# /etc/init.d/mysql stop
Copy after login

或者

$ mysqladmin -u root -p shutdown
Copy after login

7、启动mysql服务

# service mysql start
Copy after login

或者

# /etc/init.d/mysql start
Copy after login

8、重启mysql服务

# service mysql restart
Copy after login

或者

# /etc/init.d/mysql restart
Copy after login

9、连接mysql数据库

$ mysql -u root -p
Copy after login

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template