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. linux 下的进程管理工具 supervisor

    在linux下监控进程: 1)yum install python-setuptools   linux下的python安装工具 2)easy_install supervisor     安装sup ...

  2. 使用matplotlib绘制带图例的图表

    #coding=utf8 from pylab import * plt.figure(figsize=(8,10), dpi=50) plt.plot(do_tow2[28:508],do_prn2 ...

  3. javap 可以打印出用于jni调用的java函数的签名信息

    javap可以打印出java的字节码: -c     Prints out disassembled code, i.e., the instructions that comprise the Ja ...

  4. 我的github

    我的github:先来贴个图~   这是我的github,新建了第一个repository,默认路径是aokoqingiz/code. 然后是里面的文件~ 里面有一个readme.txt,是我对这个r ...

  5. Gradle – Spring 4 MVC Hello World Example – Annotation

    In this tutorial, we will take the previous Gradle + Spring MVC XML example, rewrite it to support @ ...

  6. codeforces 630B Moore's Law

    B. Moore's Law time limit per test 0.5 seconds memory limit per test 64 megabytes input standard inp ...

  7. java 方法调用绑定--《java编程思想》学习笔记

    将一个方法调用同一个方法主体关联起来,就是绑定. 绑定分两种 :前期绑定 和 后期绑定 . 绑定------------- | -----前期绑定-------编译期绑定 { static , fin ...

  8. iterm2相关配置

    使用 iterm2 登陆 公司堡垒机 进行 上传 下载文件 等维护操作.. 1.需要安装iterm2 软件 http://iterm2.com/  下载安装 2.安装brew ruby -e &quo ...

  9. Codeforces Round #277 (Div. 2) E. LIS of Sequence DP

    E. LIS of Sequence Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/486/pr ...

  10. 在WebClient中使用post[发送数据]

    很多时候,我们需要使用C#中的WebClient 来收发数据,WebClient 类提供向 URI 标识的任何本地.Intranet 或 Internet 资源发送数据以及从这些资源接收数据的公共方法 ...