总结下mysql rpm安装的方式,与一些错误

环境
[root@host2 ~]# uname -a
Linux host2 2.6.32-504.3.3.el6.x86_64 #1 SMP Wed Dec 17 01:55:02 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
[root@host2 ~]# cat /etc/issue
CentOS release 6.5 (Final)
Kernel \r on an \m

1,检查是否安装

[root@host2 ~]# rpm -qa | grep --color mysqlMySQL-5.6.22-1.linux_glibc2.5.x86_64.rpm-bundle.tar

2,删除已安装

[root@host2 ~]# rpm -e mysql-libs-5.1.71-1.el6.x86_64 --nodeps
[root@host2 ~]#

3,查验,这样删还是会留下一些东西

[root@host2 ~]# find / -name mysql
[root@host2 ~]# find / -name *mysql*
/etc/selinux/targeted/modules/active/modules/mysql.pp
/usr/lib/python2.6/site-packages/sos/plugins/mysql.pyc
/usr/lib/python2.6/site-packages/sos/plugins/mysql.pyo
/usr/lib/python2.6/site-packages/sos/plugins/mysql.py
/usr/share/vim/vim72/syntax/mysql.vim
/usr/share/selinux/devel/include/services/mysql.if
/usr/share/selinux/targeted/mysql.pp.bz2
/usr/share/doc/rsyslog-5.8.10/rsyslog_mysql.html
/usr/share/doc/rsyslog-5.8.10/ommysql.html
/usr/share/man/man5/mysql_table.5.gz
/usr/lib64/libreoffice/program/libmysqllo.so
/selinux/booleans/allow_user_mysql_connect
/selinux/booleans/mysql_connect_any
/var/lib/yum/yumdb/m/b642f65e3df41063e068158061ae2e08f22e3dad-mysql-libs-5.1.71-1.el6-x86_64

保证下面安装顺利,最好是将这些文件都删除

4,查验有否mysql用户和组
[root@host2 ~]# nl /etc/group | grep mysql
[root@host2 ~]# nl /etc/shadow | grep mysql

5,解包
[root@host2 mysql_rpm]# tar -xvf MySQL-5.6.22-1.linux_glibc2.5.x86_64.rpm-bundle.tar
MySQL-shared-compat-5.6.22-1.linux_glibc2.5.x86_64.rpm     #RHEL兼容包 
MySQL-client-5.6.22-1.linux_glibc2.5.x86_64.rpm       #MySQL客户端程序
MySQL-shared-5.6.22-1.linux_glibc2.5.x86_64.rpm    #MySQL的共享库
MySQL-server-5.6.22-1.linux_glibc2.5.x86_64.rpm        #MySQL服务端程序
MySQL-test-5.6.22-1.linux_glibc2.5.x86_64.rpm        #MySQL的测试组件
MySQL-devel-5.6.22-1.linux_glibc2.5.x86_64.rpm        #MySQL的库和头文件
MySQL-embedded-5.6.22-1.linux_glibc2.5.x86_64.rpm       #MySQL的嵌入式程序

6,安装,会自动初始化数据库

  1. [root@host2 mysql_rpm]# rpm -ivh MySQL-server-5.6.22-1.linux_glibc2.5.x86_64.rpm
  2.  
  3. Preparing... ########################################### [100%]
  4. 1:MySQL-server ########################################### [100%]
  5. warning: user mysql does not exist - using root
  6. warning: group mysql does not exist - using root
  7. 2015-01-20 13:10:42 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
  8. 2015-01-20 13:10:42 5645 [Note] InnoDB: Using atomics to ref count buffer pool pages
  9. 2015-01-20 13:10:42 5645 [Note] InnoDB: The InnoDB memory heap is disabled
  10. 2015-01-20 13:10:42 5645 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
  11. 2015-01-20 13:10:42 5645 [Note] InnoDB: Memory barrier is not used
  12. 2015-01-20 13:10:42 5645 [Note] InnoDB: Compressed tables use zlib 1.2.3
  13. 2015-01-20 13:10:42 5645 [Note] InnoDB: Using Linux native AIO
  14. 2015-01-20 13:10:42 5645 [Note] InnoDB: Not using CPU crc32 instructions
  15. 2015-01-20 13:10:42 5645 [Note] InnoDB: Initializing buffer pool, size = 128.0M
  16. 2015-01-20 13:10:42 5645 [Note] InnoDB: Completed initialization of buffer pool
  17. 2015-01-20 13:10:42 5645 [Note] InnoDB: The first specified data file ./ibdata1 did not exist: a new database to be created!
  18. 2015-01-20 13:10:42 5645 [Note] InnoDB: Setting file ./ibdata1 size to 12 MB
  19. 2015-01-20 13:10:42 5645 [Note] InnoDB: Database physically writes the file full: wait...
  20. 2015-01-20 13:10:42 5645 [Note] InnoDB: Setting log file ./ib_logfile101 size to 48 MB
  21. 2015-01-20 13:10:42 5645 [Note] InnoDB: Setting log file ./ib_logfile1 size to 48 MB
  22. 2015-01-20 13:10:43 5645 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0
  23. 2015-01-20 13:10:43 5645 [Warning] InnoDB: New log files created, LSN=45781
  24. 2015-01-20 13:10:43 5645 [Note] InnoDB: Doublewrite buffer not found: creating new
  25. 2015-01-20 13:10:43 5645 [Note] InnoDB: Doublewrite buffer created
  26. 2015-01-20 13:10:43 5645 [Note] InnoDB: 128 rollback segment(s) are active.
  27. 2015-01-20 13:10:43 5645 [Warning] InnoDB: Creating foreign key constraint system tables.
  28. 2015-01-20 13:10:43 5645 [Note] InnoDB: Foreign key constraint system tables created
  29. 2015-01-20 13:10:43 5645 [Note] InnoDB: Creating tablespace and datafile system tables.
  30. 2015-01-20 13:10:43 5645 [Note] InnoDB: Tablespace and datafile system tables created.
  31. 2015-01-20 13:10:43 5645 [Note] InnoDB: Waiting for purge to start
  32. 2015-01-20 13:10:43 5645 [Note] InnoDB: 5.6.22 started; log sequence number 0
  33. A random root password has been set. You will find it in '/root/.mysql_secret'.
  34. 2015-01-20 13:10:44 5645 [Note] Binlog end
  35. 2015-01-20 13:10:44 5645 [Note] InnoDB: FTS optimize thread exiting.
  36. 2015-01-20 13:10:44 5645 [Note] InnoDB: Starting shutdown...
  37. 2015-01-20 13:10:45 5645 [Note] InnoDB: Shutdown completed; log sequence number 1625977
  38.  
  39. 2015-01-20 13:10:45 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
  40. 2015-01-20 13:10:45 5667 [Note] InnoDB: Using atomics to ref count buffer pool pages
  41. 2015-01-20 13:10:45 5667 [Note] InnoDB: The InnoDB memory heap is disabled
  42. 2015-01-20 13:10:45 5667 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
  43. 2015-01-20 13:10:45 5667 [Note] InnoDB: Memory barrier is not used
  44. 2015-01-20 13:10:45 5667 [Note] InnoDB: Compressed tables use zlib 1.2.3
  45. 2015-01-20 13:10:45 5667 [Note] InnoDB: Using Linux native AIO
  46. 2015-01-20 13:10:45 5667 [Note] InnoDB: Not using CPU crc32 instructions
  47. 2015-01-20 13:10:45 5667 [Note] InnoDB: Initializing buffer pool, size = 128.0M
  48. 2015-01-20 13:10:45 5667 [Note] InnoDB: Completed initialization of buffer pool
  49. 2015-01-20 13:10:45 5667 [Note] InnoDB: Highest supported file format is Barracuda.
  50. 2015-01-20 13:10:45 5667 [Note] InnoDB: 128 rollback segment(s) are active.
  51. 2015-01-20 13:10:45 5667 [Note] InnoDB: Waiting for purge to start
  52. 2015-01-20 13:10:45 5667 [Note] InnoDB: 5.6.22 started; log sequence number 1625977
  53. 2015-01-20 13:10:45 5667 [Note] Binlog end
  54. 2015-01-20 13:10:45 5667 [Note] InnoDB: FTS optimize thread exiting.
  55. 2015-01-20 13:10:45 5667 [Note] InnoDB: Starting shutdown...
  56. 2015-01-20 13:10:47 5667 [Note] InnoDB: Shutdown completed; log sequence number 1625987
  57.  
  58. A RANDOM PASSWORD HAS BEEN SET FOR THE MySQL root USER !
  59. You will find that password in '/root/.mysql_secret'.
  60.  
  61. You must change that password on your first connect,
  62. no other statement but 'SET PASSWORD' will be accepted.
  63. See the manual for the semantics of the 'password expired' flag.
  64.  
  65. Also, the account for the anonymous user has been removed.
  66.  
  67. In addition, you can run:
  68.  
  69. /usr/bin/mysql_secure_installation
  70.  
  71. which will also give you the option of removing the test database.
  72. This is strongly recommended for production servers.
  73.  
  74. See the manual for more instructions.
  75.  
  76. Please report any problems at http://bugs.mysql.com/
  77.  
  78. The latest information about MySQL is available on the web at
  79.  
  80. http://www.mysql.com
  81.  
  82. Support MySQL by buying support/licenses at http://shop.mysql.com
  83.  
  84. New default config file was created as /usr/my.cnf and
  85. will be used by default by the server when you start it.
  86. You may edit this file to change server settings

 

7,RPM安装方式文件分布

Table 2.6 MySQLInstallation Layout for Linux RPM Packages from the MySQL DeveloperZone

Directory Contentsof Directory
/usr/bin Clientprograms and scripts
/usr/sbin Themysqldserver
/var/lib/mysql Logfiles, databases
/usr/share/info Manualin Info format
/usr/share/man Unixmanual pages
/usr/include/mysql Include(header) files
/usr/lib/mysql Libraries
/usr/share/mysql Miscellaneoussupport files, including error messages, character set files,sample configuration files, SQL for database installation
/usr/share/sql-bench Benchmarks

8,copy配置文件
# 没有这一步也可以按内置参数
[root@host2 mysql_rpm]# cp /usr/share/mysql/my-default.cnf /etc/my.cnf

9,启动mysql
[root@host2 mysql_rpm]# service mysql status
MySQL is not running                                       [FAILED]
[root@host2 mysql_rpm]# service mysql start
Starting MySQL..                                           [  OK  ]

10,检查进程
[root@host2 mysql_rpm]# netstat -anpl | grep mysql
tcp        0      0 :::3306                     :::*                        LISTEN      5924/mysqld         
unix  2      [ ACC ]     STREAM     LISTENING     76015  5924/mysqld         /var/lib/mysql/mysql.sock

11,安装客户端
[root@host2 mysql_rpm]# rpm -ivh MySQL-client-5.6.22-1.linux_glibc2.5.x86_64.rpm 
Preparing...                ########################################### [100%]
   1:MySQL-client           ########################################### [100%]

12,连到mysql并修改
[root@host2 mysql_rpm]# nl /root/.mysql_secret
     1    # The random password set for the root user at Tue Jan 20 13:10:43 2015 (local time): F76Wy1A4G9ZuLcaG ---这是初次登录mysql,root的密码

  1. [root@host2 mysql_rpm]# mysql -p mysql
  2. Enter password:
  3. Welcome to the MySQL monitor. Commands end with ; or \g.
  4. Your MySQL connection id is 4
  5. Server version: 5.6.22
  6.  
  7. Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
  8.  
  9. Oracle is a registered trademark of Oracle Corporation and/or its
  10. affiliates. Other names may be trademarks of their respective
  11. owners.
  12.  
  13. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
  14.  
  15. mysql> show databases;
  16. ERROR 1820 (HY000): You must SET PASSWORD before executing this statement
  17. mysql>
  18. mysql> SET PASSWORD = PASSWORD('123456');
  19. Query OK, 0 rows affected (0.31 sec)
  20.  
  21. mysql> flush privileges;
  22. mysql> \q
  23. Bye

在启动过程中,曾遇到这个错误(The server quit without updating PID file),相信许多人应该也遇到过,做下总结:
原因:在MySQL的datadir数据目录下没有pid文件或者未被授权
解决方式:
(1)一定要给譬如/data/mysql授权
         chown -R mysql:mysql /data/mysql
(2)如果授权了不好使,你可以自己在/data/mysql下建立一个以主机名命名的pid,如我的主机名是centos-6.3
          你可以cd /data/mysql && touch centos-6.3.pid
           在里面随意写一个进程中没有的pid号
 (3)如果还是不行,你就需要看看配置文件/etc/my.cnf里面的配置了,将port、datadir、basedir、 socket前的#去掉

(4)另外的处理方法还有可能是下面的原因导致
   1>可能是第二次在机器上安装mysql,有残余数据影响了服务的启动。
         解决方法:去mysql的数据目录/data看看,如果存在mysql-bin.index,就赶快把它删除掉吧,它就是罪魁祸首了

  2>mysql在启动时没有指定配置文件时会使用/etc/my.cnf配置文件,请打开这个文件查看在[mysqld]节下有没有指定数据目录(datadir)。
    解决方法:请在[mysqld]下设置这一行:datadir = /usr/local/mysql/data

  3>skip-federated字段问题

    解决方法:检查一下/etc/my.cnf文件中有没有没被注释掉的skip-federated字段,如果有就立即注释掉吧。

  4>selinux惹的祸,如果是centos系统,默认会开启selinux(今天遇到的错误就是这个)
    解决方法:关闭它,打开/etc/selinux/config,把SELINUX=enforcing改为SELINUX=disabled后存盘退出重启机器试试。

Mysql rpm安装的更多相关文章

  1. Linux CentOS6 mysql rpm安装

    mysql rpm文件下载地址:https://dev.mysql.com/downloads/mysql/ 选择操作系统及版本: 点击5.6版本链接 将下载好的文件上传至服务器 下面开始安装: 检查 ...

  2. linux下安装mysql(rpm安装)

    Mysql 5.7.29安装步骤 1.首先卸载自带的Mysql-libs(如果之前安装过mysql,要全都卸载掉) rpm -qa | grep -i -E mysql\|mariadb | xarg ...

  3. 笔记--mysql rpm 安装

    1.rpm包下载 http://taokey.blog.51cto.com/4633273/1630561

  4. mysql rpm安装,以及修改charset

    http://my.oschina.net/u/1156660/blog/343154?fromerr=tmDGGiDL 修改charset: http://stackoverflow.com/que ...

  5. Mysql UPF 安装文档

    一.mysql UDF 简介: github地址: http://www.mysqludf.org/lib_mysqludf_preg 二.mysql UDF 下载地址: https://github ...

  6. MySQL通过RPM安装

    以前写过一篇文章,RedHat Linux 6.1 安装MySQL,本文是从解决依赖的角度上再次描述如何在Linux下以RPM包方式安装MySQL. [root@serv01 ~]# ls /iso/ ...

  7. 使用rpm安装mysql的默认目录

    --使用rpm安装mysql的默认目录:1.数据库目录/var/lib/mysql/2.配置文件/usr/share/mysql(mysql.server命令及配置文件)3.相关命令/usr/bin( ...

  8. centos 6.4 mysql rpm 离线安装【备忘】

    离线状态下使用rpm的安装包进行mysql的安装,仅作备忘 准备工作: 官网下载mysql离线rpm安装包(这里就不演示了,拿现成的做演示) =================更新线 2018-01- ...

  9. MySQL RPM二进制安装

    +++++++++++++++++++++++++++++++++++++++++++标题:MySQL RPM二进制安装时间:2019年2月24日内容:MySQL RPM二进制安装重点:MySQL R ...

随机推荐

  1. jquery的animate关于background-position属性

    jQuery 的 animate 虽然能直接使用 CSS 的方式来进行动画,但有些属性其实是不支持的,例如:background-position. 谷歌支持 background-position- ...

  2. 【Kafka源码】Kafka启动过程

    一般来说,我们是通过命令来启动kafka,但是命令的本质还是调用代码中的main方法,所以,我们重点看下启动类Kafka.源码下下来之后,我们也可以通过直接运行Kafka.scala中的main方法( ...

  3. ERROR 1064 (42000): You have an error in your SQL syntax;

    出现: ERROR 1064 (42000): You have an error in your SQL syntax; 1.SQL语句拼写错误. 具体很简单.慢慢查看 2.使用到了SQL关键字. ...

  4. ECharts概念学习系列之ECharts官网教程之自定义构建 ECharts(图文详解)

    不多说,直接上干货! 官网 http://echarts.baidu.com/tutorial.html#%E8%87%AA%E5%AE%9A%E4%B9%89%E6%9E%84%E5%BB%BA%2 ...

  5. javascript中的function 函数名(){} 和 函数名:function(){}有什么不同

    function functionName(){};这是定义一个函数 functionName:function(){};是设置一个对象的方法. 下面举一个例子: <html> <h ...

  6. JavaScript设计模式-1.函数

    <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title> ...

  7. django显示SQL语句

    django显示SQL语句 有时候我们使用模型查询数据,但是并不知道具体执行的SQL语句到底对不对.那么可以通过下面的方法打印出具体执行的SQL语句.这样有助于调试: queryset = MyMod ...

  8. python笔记01-----列表操作

    在python中列表用 '[]' 表示 列表的查询操作 列表的切片 names = ["a","b","c"]             #定 ...

  9. 在Linux上创建webrev(cont)[基于svn]

    在前文中,基于git介绍了webrev工具.实际上,webrev工具还支持hg和svn.最近的工作中不可避免地要使用svn,故在此总结一下如何基于svn在Linux上创建webrev.顺便吐个槽,没有 ...

  10. nginx timeout 配置 全局timeout 局部timeout web timeout

    nginx比较强大,可以针对单个域名请求做出单个连接超时的配置. 比如些动态解释和静态解释可以根据业务的需求配置 proxy_connect_timeout :后端服务器连接的超时时间_发起握手等候响 ...