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. 新手指导:教你如何查看识别hadoop是32位还是64位

    问题导读: 1.从哪些地方可以识别hadoop是32位还是64位?2.hadoop本地库在什么位置? 来源:about云 本文链接:http://www.aboutyun.com/thread-127 ...

  2. LeetCode 232 Implement Queue using Stacks

    Implement the following operations of a queue using stacks. push(x) -- Push element x to the back of ...

  3. 【转】nginx的优缺点

    原博文出自于:http://blog.csdn.net/a454211787/article/details/22494485     感谢! 1.nginx相对于apache优点: 轻量级同样起we ...

  4. Spark计算工作流

    下图 中描述了 Spark 的输入.运行转换.输出.在运行转换中通过算子对 RDD进行转换.算子是 RDD 中定义的函数,可以对 RDD 中的数据进行转换和操作.‰ 输入:在 Spark 程序运行中, ...

  5. 【转】在企业内部分发 iOS 应用程序

    (via:破船之家,原文:Provision iOS IPA App for In-House Enterprise Distribution)   在企业内部分发 iOS 应用程序非常复杂.经过努力 ...

  6. Codeforces 599C Day at the Beach(想法题,排序)

    C. Day at the Beach One day Squidward, Spongebob and Patrick decided to go to the beach. Unfortunate ...

  7. JSF 2 dropdown box example

    In JSF, <h:selectOneMenu /> tag is used to render a dropdown box – HTML select element with &q ...

  8. poj 2226 Muddy Fields(最小覆盖点+构图)

    http://poj.org/problem?id=2226 Muddy Fields Time Limit: 1000MS   Memory Limit: 65536K Total Submissi ...

  9. 转载IEnumerable与IEnumerator区别

    public interface IEnumerable {     IEnumerator GetEnumerator(); }   public interface IEnumerator {   ...

  10. Spring Data JPA教程, 第二部分: CRUD(翻译)

    我的Spring Data Jpa教程的第一部分描述了,如何配置Spring Data JPA,本博文进一步描述怎样使用Spring Data JPA创建一个简单的CRUD应用.该应用要求如下: pe ...