mysql的安装

一、yum源格式安装mysql

1、将下载的yum包上传到linux上:

[root@localhost ~]# ls
mysql-community-release-el6-5.noarch.rpm

2、列出rpm包中文件(查看哪些内容):

[root@localhost ~]# rpm -qpl mysql-community-release-el6-5.noarch.rpm
/etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
/etc/yum.repos.d/mysql-community-source.repo
/etc/yum.repos.d/mysql-community.repo

3、安装rpm包(自动配置好yum源):

[root@localhost ~]# rpm -ivh mysql-community-release-el6-5.noarch.rpm
Preparing... ########################################### [100%]
1:mysql-community-release########################################### [100%]

4、安装mysql:

[root@localhost ~]# yum install mysql-community-server.x86_64 -y
Loaded plugins: fastestmirror, refresh-packagekit, security
Existing lock /var/run/yum.pid: another copy is running as pid 2460.
Another app is currently holding the yum lock; waiting for it to exit... Verifying : mysql-community-libs-5.6.29-2.el6.x86_64 5/8
Verifying : 2:postfix-2.6.6-6.el6_7.1.x86_64 6/8
Verifying : 2:postfix-2.6.6-2.2.el6_1.x86_64 7/8
Verifying : mysql-libs-5.1.71-1.el6.x86_64 8/8
Installed:
mysql-community-libs.x86_64 0:5.6.29-2.el6 mysql-community-libs-compat.x86_64 0:5.6.29-2.el6 mysql-community-server.x86_64 0:5.6.29-2.el6
Dependency Installed:
mysql-community-client.x86_64 0:5.6.29-2.el6 mysql-community-common.x86_64 0:5.6.29-2.el6
Dependency Updated:
postfix.x86_64 2:2.6.6-6.el6_7.1
Replaced:
mysql-libs.x86_64 0:5.1.71-1.el6
Complete!

5、是否安装了mysql:

[root@localhost ~]# rpm -qa | grep mysql
mysql-community-libs-5.6.29-2.el6.x86_64
mysql-community-server-5.6.29-2.el6.x86_64
mysql-community-client-5.6.29-2.el6.x86_64
mysql-community-libs-compat-5.6.29-2.el6.x86_64
mysql-community-release-el6-5.noarch
mysql-community-common-5.6.29-2.el6.x86_64

6、接下来是初始化数据库:

[root@localhost ~]# mysql_install_db --datadir=/var/lib/mysql/
Installing MySQL system tables...2016-03-15 11:00:50 0 [Warning] TIMESTAMP wi

7、更改数据库目录权限并启动mysql:

[root@localhost ~]# chown -R mysql:mysql /var/lib/mysql/
[root@localhost ~]# ll -h /var/lib/mysql/
总用量 109M
-rw-rw----. 1 mysql mysql 12M 3月 15 11:00 ibdata1
-rw-rw----. 1 mysql mysql 48M 3月 15 11:00 ib_logfile0
-rw-rw----. 1 mysql mysql 48M 3月 15 11:00 ib_logfile1
drwx------. 2 mysql mysql 4.0K 3月 15 11:00 mysql
drwx------. 2 mysql mysql 4.0K 3月 15 11:00 performance_schema
[root@localhost ~]# /etc/init.d/mysqld start
正在启动 mysqld: [确定]

8、登录mysql并修改密码:

[root@localhost ~]# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.6.29 MySQL Community Server (GPL) Copyright (c) 2000, 2016, 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>

mysql> update mysql.user set password=password("123456")where user='root';
Query OK, 3 rows affected (0.11 sec)
Rows matched: 4 Changed: 3 Warnings: 0

mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
+--------------------+
3 rows in set (0.04 sec)

  

二、RPM方式安装mysql:

1.将下载好的文件上传到Linux下:

[root@localhost Downloads]# ls
MySQL-5.6.16-1.el6.x86_64.rpm-bundle.tar

2、解压tar文件:

[root@localhost Downloads]# tar -xf MySQL-5.6.16-1.el6.x86_64.rpm-bundle.tar

[root@localhost Downloads]# ls
MySQL-client-5.6.16-1.el6.x86_64.rpm
MySQL-devel-5.6.16-1.el6.x86_64.rpm
MySQL-embedded-5.6.16-1.el6.x86_64.rpm
MySQL-server-5.6.16-1.el6.x86_64.rpm
MySQL-shared-5.6.16-1.el6.x86_64.rpm
MySQL-shared-compat-5.6.16-1.el6.x86_64.rpm
MySQL-test-5.6.16-1.el6.x86_64.rpm

3、安装rpm文件:

[root@localhost Downloads]# rpm -Uvh MySQL-*
Preparing... ########################################### [100%]
1:MySQL-devel ########################################### [ 14%]
2:MySQL-client ########################################### [ 29%]
3:MySQL-test ########################################### [ 43%]
4:MySQL-embedded ########################################### [ 57%]
5:MySQL-shared-compat ########################################### [ 71%]
6:MySQL-shared ########################################### [ 86%]
7:MySQL-server ########################################### [100%]

4、启动mysql服务:

[root@localhost mysql]# /etc/init.d/mysql start
Starting MySQL........ [ OK ]

linux下 yum源、rpm、源代码安装mysql的更多相关文章

  1. [Linux] 使用Yum在CentOS上安装MySQL

    跟随官网上的安装教程:https://dev.mysql.com/doc/refman/8.0/en/linux-installation-yum-repo.html官网上还有一个QuickGuide ...

  2. 在Linux下用源码编译安装apache2

    Linux下安装一个软件,最好去看下它的官方guide,apache2.4的安装安装guide 0. installation guide http://httpd.apache.org/docs/2 ...

  3. LINUX下YUM源配置

    转自:http://www.cnblogs.com/phoebus0501/archive/2010/12/14/1906144.html 1.确保RHEL5中已经安装了yum [root@lvs-m ...

  4. linux下如何源码编译安装vim

    1. 获取源码 git clone https://github.com/vim/vim.git ~/vim cd ~/vim 2. 配置 ./configure --prefix=/home/jel ...

  5. Linux下DNW源码及安装

    平台: Ubuntu12.04 + 64bit tiny4412ADK 1.首先要安装libusb-dev这个库,执行“sudo apt-get install libusb-dev”,装完之后就编译 ...

  6. Linux下yum安装MySQL

    写这篇文章的原因是:在刚开始使用Linux操作系统时想要搭建LAMP环境,于是开始在Google和百度上各种寻找资料,碰到了不是很多的问题后,我决定写这篇文章总结一下在Linux下yum安装MySQL ...

  7. CentOS 6.6 下源码编译安装MySQL 5.7.5

    版权声明:转自:http://www.linuxidc.com/Linux/2015-08/121667.htm 说明:CentOS 6.6 下源码编译安装MySQL 5.7.5 1. 安装相关工具# ...

  8. CentOS7下通过rpm方式安装MySQL及插入中文问题解决 [原创]

    一 CentOS下通过rpm方式安装MySQL CentOS版本:CentOS-7 MySQL版本:MySQL-5.6.22 在网上搜了一下,Linux下安装MYSQL有三种方式: 1) 通过yum命 ...

  9. 【夯实PHP基础系列】linux下yum安装PHP APC

    Alternative PHP Cache(可选PHP缓存),依赖于 PECL扩展库 用源码方式安装,直接yum就行了:首先要安装apc的依赖包:yum install php-pear php-de ...

随机推荐

  1. 给sublime text添加ubuntu launcher快捷方式

    1.下载sublime text 2文件,解压并复制到/opt目录,文件夹名称不要含有空格 2.在/usr/share/applications目录下新建sublime_text.desktop文件 ...

  2. HDU5806:NanoApe Loves Sequence Ⅱ(尺取法)

    题目链接:HDU5806 题意:找出有多少个区间中第k大数不小于m. 分析:用尺取法可以搞定,CF以前有一道类似的题目. #include<cstdio> using namespace ...

  3. ffmpeg 研究

    ffmpeg -codecs | grep mp3 可以查看ffmpeg是否把mp3编解码模块编译进去了. libmp3lame is the mp3 encoder for ffmpeg. It n ...

  4. linux 下终端复用软件推荐——tmux

    使用过些linux终端,比如Tilda.Terminator. 之前最经常用的是Terminator,其可以上下左右分屏,比较方便,但其有个缺点是经常无故崩溃. 后来遇到Tmux,根据网上的设置配置了 ...

  5. iOS WebServiceFramework网络服务框架浅解

    网络服务几乎是每一款成功APP的必备条件,打开你手机你会发现里面不用联网的应用数量十只手指可以数出来,就算是一些以独特技术切入市场的APP如美颜相机,都至少加入了分享功能.下面我先做下简单的回顾兼扫盲 ...

  6. [C语言 - 3] 字符串

    字符数组 char * 看做一个特殊的字符数组, 在字符串结束为止添加'\0'结束符 (ASCII码0), 没有\0结尾的是普通的字符数组. 使用双引号定义的字符串自动在尾部加上\0 puts(s)函 ...

  7. windows 花式装系统

    目录 一.安装系统前准备 准备U盘 准备好一个制作启动盘的软件 准备系统镜像 二.接下来先制作启动盘(以微PE为例) 三.插上u盘,调BIOS(BIOS即基本输入输出系统) 四.进入PE 五.开始安装 ...

  8. sql 调用函数的方法

    USE [ChangHong_612]GO/****** Object: StoredProcedure [dbo].[st_MES_RptInspectWeight] Script Date: 09 ...

  9. MATLAB代码

    clear;clc%%%%%%%%%%%%方程里的参量%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%alpha=0.5;beta=0.5;%%% ...

  10. nginx将http重定向到https

    1.rewrite server { listen 80; server_name test.com; rewrite ^(.*)$ https://$host$1 permanent; } 2. n ...