centos6 mysql 安装与配置

MySQL简介:

由于其体积小、速度快、总体拥有成本低,尤其是开放源码这一特点,许多中小型网站为了降低网站总体拥有成本而选择了MySQL作为网站数据库。MySQL是一个多用户、多线程的关系型数据库管理系统。 工作模式是基于客户机/服务器结构。目前它可以支持几乎所有的操作系统,同时也可以和php完美结合。

简单的来说 ,MySql是一个开放的、快速的、多线程的、多用户的SQL数据库服务器。

特点:

(1)开放性 

(2)多线程

(3)之处多种API

(4)跨数据库连接 

(5)国际化  

(6)巨大的数据库体积

常用命令: 

连接Mysql:

1)连接到本机MySQL:mysql -u用户名 -p用户密码

2)连接到远程主机上的MySQL:mysql -h主机地址 -u用户名 -p用户密码

3)退出MySQL命令:exit 

实验步骤:

1.安装软件

yum install mysql-server
yum install php-mysql

2.启动MySQL

service mysqld start

3.开机总动启动

[root@localhost ~]# chkconfig --list | grep mysql
mysqld          0:关闭  1:关闭  2:关闭  3:关闭  4:关闭  5:关闭  6:关闭

4.我们发现mysqld服务并没有开机自动启动,我们当然可以通过 chkconfig mysqld on 命令来将其设置成开机启动。

[root@localhost ~]# chkconfig mysqld on
[root@localhost ~]# chkconfig --list |grep mysql
mysqld          0:关闭  1:关闭  2:启用  3:启用  4:启用  5:启用  6:关闭

5.为root设置一个密码

mysqladmin -u root password root

6.此时,我们输入mysql -u root -p 进入数据库

[root@localhost ~]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or g.
Your MySQL connection id is 3
Server version: 5.1.61 Source distribution
 
Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
 
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
 
Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.
 
mysql>
原文地址:https://www.cnblogs.com/houdj/p/9297617.html