ITPub博客

首页 > 数据库 > MySQL > Linux下安装Mysql

Linux下安装Mysql

原创 MySQL 作者:lnwxzyp 时间:2016-05-30 14:56:15 0 删除 编辑
      首先访问oracle官方网站下载 http://dev.mysql.com/downloads 如下文件:
  1. MySQL-server-5.6.20-1.el6.x86_64.rpm
  2. MySQL-devel-5.6.20-1.el6.x86_64.rpm
  3. MySQL-client-5.6.20-1.el6.x86_64.rpm
然后在Linux中使用root账号执行安装:
  1. [root@Hadoop mysql]# rpm -ivh MySQL-server-5.6.20-1.el6.x86_64.rpm
  2. Preparing... ########################################### [100%]
  3.     file /usr/share/mysql/czech/errmsg.sys from install of MySQL-server-5.6.20-1.el6.x86_64 conflicts with file from package mysql-libs-5.1.66-2.el6_3.x86_64
  4.     file /usr/share/mysql/danish/errmsg.sys from install of MySQL-server-5.6.20-1.el6.x86_64 conflicts with file from package mysql-libs-5.1.66-2.el6_3.x86_64
  5.     file /usr/share/mysql/dutch/errmsg.sys from install of MySQL-server-5.6.20-1.el6.x86_64 conflicts with file from package mysql-libs-5.1.66-2.el6_3.x86_64
  6.     file /usr/share/mysql/english/errmsg.sys from install of MySQL-server-5.6.20-1.el6.x86_64 conflicts with file from package mysql-libs-5.1.66-2.el6_3.x86_64
  7.     file /usr/share/mysql/estonian/errmsg.sys from install of MySQL-server-5.6.20-1.el6.x86_64 conflicts with file from package mysql-libs-5.1.66-2.el6_3.x86_64
  8.     file /usr/share/mysql/french/errmsg.sys from install of MySQL-server-5.6.20-1.el6.x86_64 conflicts with file from package mysql-libs-5.1.66-2.el6_3.x86_64
  9.     file /usr/share/mysql/german/errmsg.sys from install of MySQL-server-5.6.20-1.el6.x86_64 conflicts with file from package mysql-libs-5.1.66-2.el6_3.x86_64
  10.     file /usr/share/mysql/greek/errmsg.sys from install of MySQL-server-5.6.20-1.el6.x86_64 conflicts with file from package mysql-libs-5.1.66-2.el6_3.x86_64
  11.     file /usr/share/mysql/hungarian/errmsg.sys from install of MySQL-server-5.6.20-1.el6.x86_64 conflicts with file from package mysql-libs-5.1.66-2.el6_3.x86_64
  12.     file /usr/share/mysql/italian/errmsg.sys from install of MySQL-server-5.6.20-1.el6.x86_64 conflicts with file from package mysql-libs-5.1.66-2.el6_3.x86_64
  13.     file /usr/share/mysql/japanese/errmsg.sys from install of MySQL-server-5.6.20-1.el6.x86_64 conflicts with file from package mysql-libs-5.1.66-2.el6_3.x86_64
  14.     file /usr/share/mysql/korean/errmsg.sys from install of MySQL-server-5.6.20-1.el6.x86_64 conflicts with file from package mysql-libs-5.1.66-2.el6_3.x86_64
  15.     file /usr/share/mysql/norwegian-ny/errmsg.sys from install of MySQL-server-5.6.20-1.el6.x86_64 conflicts with file from package mysql-libs-5.1.66-2.el6_3.x86_64
  16.     file /usr/share/mysql/norwegian/errmsg.sys from install of MySQL-server-5.6.20-1.el6.x86_64 conflicts with file from package mysql-libs-5.1.66-2.el6_3.x86_64
  17.     file /usr/share/mysql/polish/errmsg.sys from install of MySQL-server-5.6.20-1.el6.x86_64 conflicts with file from package mysql-libs-5.1.66-2.el6_3.x86_64
  18.     file /usr/share/mysql/portuguese/errmsg.sys from install of MySQL-server-5.6.20-1.el6.x86_64 conflicts with file from package mysql-libs-5.1.66-2.el6_3.x86_64
  19.     file /usr/share/mysql/romanian/errmsg.sys from install of MySQL-server-5.6.20-1.el6.x86_64 conflicts with file from package mysql-libs-5.1.66-2.el6_3.x86_64
  20.     file /usr/share/mysql/russian/errmsg.sys from install of MySQL-server-5.6.20-1.el6.x86_64 conflicts with file from package mysql-libs-5.1.66-2.el6_3.x86_64
  21.     file /usr/share/mysql/serbian/errmsg.sys from install of MySQL-server-5.6.20-1.el6.x86_64 conflicts with file from package mysql-libs-5.1.66-2.el6_3.x86_64
  22.     file /usr/share/mysql/slovak/errmsg.sys from install of MySQL-server-5.6.20-1.el6.x86_64 conflicts with file from package mysql-libs-5.1.66-2.el6_3.x86_64
  23.     file /usr/share/mysql/spanish/errmsg.sys from install of MySQL-server-5.6.20-1.el6.x86_64 conflicts with file from package mysql-libs-5.1.66-2.el6_3.x86_64
  24.     file /usr/share/mysql/swedish/errmsg.sys from install of MySQL-server-5.6.20-1.el6.x86_64 conflicts with file from package mysql-libs-5.1.66-2.el6_3.x86_64
  25.     file /usr/share/mysql/ukrainian/errmsg.sys from install of MySQL-server-5.6.20-1.el6.x86_64 conflicts with file from package mysql-libs-5.1.66-2.el6_3.x86_64
  26.     file /usr/share/mysql/charsets/Index.xml from install of MySQL-server-5.6.20-1.el6.x86_64 conflicts with file from package mysql-libs-5.1.66-2.el6_3.x86_64
  27.     file /usr/share/mysql/charsets/armscii8.xml from install of MySQL-server-5.6.20-1.el6.x86_64 conflicts with file from package mysql-libs-5.1.66-2.el6_3.x86_64
  28.     file /usr/share/mysql/charsets/ascii.xml from install of MySQL-server-5.6.20-1.el6.x86_64 conflicts with file from package mysql-libs-5.1.66-2.el6_3.x86_64
  29.     file /usr/share/mysql/charsets/cp1250.xml from install of MySQL-server-5.6.20-1.el6.x86_64 conflicts with file from package mysql-libs-5.1.66-2.el6_3.x86_64
  30.     file /usr/share/mysql/charsets/cp1256.xml from install of MySQL-server-5.6.20-1.el6.x86_64 conflicts with file from package mysql-libs-5.1.66-2.el6_3.x86_64
  31.     file /usr/share/mysql/charsets/cp1257.xml from install of MySQL-server-5.6.20-1.el6.x86_64 conflicts with file from package mysql-libs-5.1.66-2.el6_3.x86_64
  32.     file /usr/share/mysql/charsets/cp850.xml from install of MySQL-server-5.6.20-1.el6.x86_64 conflicts with file from package mysql-libs-5.1.66-2.el6_3.x86_64
  33.     file /usr/share/mysql/charsets/cp852.xml from install of MySQL-server-5.6.20-1.el6.x86_64 conflicts with file from package mysql-libs-5.1.66-2.el6_3.x86_64
  34.     file /usr/share/mysql/charsets/cp866.xml from install of MySQL-server-5.6.20-1.el6.x86_64 conflicts with file from package mysql-libs-5.1.66-2.el6_3.x86_64
  35.     file /usr/share/mysql/charsets/dec8.xml from install of MySQL-server-5.6.20-1.el6.x86_64 conflicts with file from package mysql-libs-5.1.66-2.el6_3.x86_64
  36.     file /usr/share/mysql/charsets/geostd8.xml from install of MySQL-server-5.6.20-1.el6.x86_64 conflicts with file from package mysql-libs-5.1.66-2.el6_3.x86_64
  37.     file /usr/share/mysql/charsets/greek.xml from install of MySQL-server-5.6.20-1.el6.x86_64 conflicts with file from package mysql-libs-5.1.66-2.el6_3.x86_64
  38.     file /usr/share/mysql/charsets/hebrew.xml from install of MySQL-server-5.6.20-1.el6.x86_64 conflicts with file from package mysql-libs-5.1.66-2.el6_3.x86_64
  39.     file /usr/share/mysql/charsets/hp8.xml from install of MySQL-server-5.6.20-1.el6.x86_64 conflicts with file from package mysql-libs-5.1.66-2.el6_3.x86_64
  40.     file /usr/share/mysql/charsets/keybcs2.xml from install of MySQL-server-5.6.20-1.el6.x86_64 conflicts with file from package mysql-libs-5.1.66-2.el6_3.x86_64
  41.     file /usr/share/mysql/charsets/koi8r.xml from install of MySQL-server-5.6.20-1.el6.x86_64 conflicts with file from package mysql-libs-5.1.66-2.el6_3.x86_64
  42.     file /usr/share/mysql/charsets/koi8u.xml from install of MySQL-server-5.6.20-1.el6.x86_64 conflicts with file from package mysql-libs-5.1.66-2.el6_3.x86_64
  43.     file /usr/share/mysql/charsets/latin1.xml from install of MySQL-server-5.6.20-1.el6.x86_64 conflicts with file from package mysql-libs-5.1.66-2.el6_3.x86_64
  44.     file /usr/share/mysql/charsets/latin2.xml from install of MySQL-server-5.6.20-1.el6.x86_64 conflicts with file from package mysql-libs-5.1.66-2.el6_3.x86_64
  45.     file /usr/share/mysql/charsets/latin5.xml from install of MySQL-server-5.6.20-1.el6.x86_64 conflicts with file from package mysql-libs-5.1.66-2.el6_3.x86_64
  46.     file /usr/share/mysql/charsets/latin7.xml from install of MySQL-server-5.6.20-1.el6.x86_64 conflicts with file from package mysql-libs-5.1.66-2.el6_3.x86_64
  47.     file /usr/share/mysql/charsets/macce.xml from install of MySQL-server-5.6.20-1.el6.x86_64 conflicts with file from package mysql-libs-5.1.66-2.el6_3.x86_64
  48.     file /usr/share/mysql/charsets/macroman.xml from install of MySQL-server-5.6.20-1.el6.x86_64 conflicts with file from package mysql-libs-5.1.66-2.el6_3.x86_64
  49.     file /usr/share/mysql/charsets/swe7.xml from install of MySQL-server-5.6.20-1.el6.x86_64 conflicts with file from package mysql-libs-5.1.66-2.el6_3.x86_64
  50.     file /usr/bin/my_print_defaults from install of MySQL-server-5.6.20-1.el6.x86_64 conflicts with file from package mysql-5.1.66-2.el6_3.x86_64
  51.     file /usr/share/man/man1/my_print_defaults.1.gz from install of MySQL-server-5.6.20-1.el6.x86_64 conflicts with file from package mysql-5.1.66-2.el6_3.x86_64
出现conflicts,解决办法如下:
  1. [root@Hadoop mysql]# yum -y remove mysql-libs-5.1.66*
  2. Loaded plugins: refresh-packagekit, security
  3. Setting up Remove Process
  4. Resolving Dependencies
  5. --> Running transaction check
  6. ---> Package mysql-libs.x86_64 0:5.1.66-2.el6_3 will be erased
  7. --> Processing Dependency: libmysqlclient.so.16()(64bit) for package: mysql-devel-5.1.66-2.el6_3.x86_64
  8. --> Processing Dependency: libmysqlclient.so.16()(64bit) for package: 2:postfix-2.6.6-2.2.el6_1.x86_64
  9. --> Processing Dependency: libmysqlclient.so.16()(64bit) for package: mysql-5.1.66-2.el6_3.x86_64
  10. --> Processing Dependency: libmysqlclient.so.16(libmysqlclient_16)(64bit) for package: 2:postfix-2.6.6-2.2.el6_1.x86_64
  11. --> Processing Dependency: libmysqlclient.so.16(libmysqlclient_16)(64bit) for package: mysql-5.1.66-2.el6_3.x86_64
  12. --> Processing Dependency: libmysqlclient_r.so.16()(64bit) for package: mysql-devel-5.1.66-2.el6_3.x86_64
  13. --> Processing Dependency: libmysqlclient_r.so.16()(64bit) for package: mysql-5.1.66-2.el6_3.x86_64
  14. --> Processing Dependency: libmysqlclient_r.so.16(libmysqlclient_16)(64bit) for package: mysql-5.1.66-2.el6_3.x86_64
  15. --> Processing Dependency: mysql-libs for package: 2:postfix-2.6.6-2.2.el6_1.x86_64
  16. --> Processing Dependency: mysql-libs = 5.1.66-2.el6_3 for package: mysql-5.1.66-2.el6_3.x86_64
  17. --> Running transaction check
  18. ---> Package mysql.x86_64 0:5.1.66-2.el6_3 will be erased
  19. ---> Package mysql-devel.x86_64 0:5.1.66-2.el6_3 will be erased
  20. ---> Package postfix.x86_64 2:2.6.6-2.2.el6_1 will be erased
  21. --> Processing Dependency: /usr/sbin/sendmail for package: cronie-1.4.4-7.el6.x86_64
  22. --> Processing Dependency: /usr/sbin/sendmail for package: redhat-lsb-core-4.0-7.0.1.el6.x86_64
  23. --> Running transaction check
  24. ---> Package cronie.x86_64 0:1.4.4-7.el6 will be erased
  25. --> Processing Dependency: cronie = 1.4.4-7.el6 for package: cronie-anacron-1.4.4-7.el6.x86_64
  26. ---> Package redhat-lsb-core.x86_64 0:4.0-7.0.1.el6 will be erased
  27. --> Processing Dependency: redhat-lsb-core(x86-64) = 4.0 for package: redhat-lsb-graphics-4.0-7.0.1.el6.x86_64
  28. --> Processing Dependency: redhat-lsb-core(x86-64) = 4.0-7.0.1.el6 for package: redhat-lsb-4.0-7.0.1.el6.x86_64
  29. --> Processing Dependency: redhat-lsb-core(x86-64) = 4.0 for package: redhat-lsb-printing-4.0-7.0.1.el6.x86_64
  30. --> Running transaction check
  31. ---> Package cronie-anacron.x86_64 0:1.4.4-7.el6 will be erased
  32. ---> Package redhat-lsb.x86_64 0:4.0-7.0.1.el6 will be erased
  33. --> Processing Dependency: redhat-lsb(x86-64) = 4.0-7.0.1.el6 for package: redhat-lsb-compat-4.0-7.0.1.el6.x86_64
  34. ---> Package redhat-lsb-graphics.x86_64 0:4.0-7.0.1.el6 will be erased
  35. ---> Package redhat-lsb-printing.x86_64 0:4.0-7.0.1.el6 will be erased
  36. --> Running transaction check
  37. ---> Package redhat-lsb-compat.x86_64 0:4.0-7.0.1.el6 will be erased
  38. --> Processing Dependency: /etc/cron.d for package: crontabs-1.10-33.el6.noarch
  39. --> Processing Dependency: /etc/cron.d for package: sysstat-9.0.4-20.el6.x86_64
  40. --> Restarting Dependency Resolution with new changes.
  41. --> Running transaction check
  42. ---> Package crontabs.noarch 0:1.10-33.el6 will be erased
  43. ---> Package sysstat.x86_64 0:9.0.4-20.el6 will be erased
  44. --> Finished Dependency Resolution

  45. Dependencies Resolved

  46. ============================================================================================================================================================
  47.  Package Arch Version Repository Size
  48. ============================================================================================================================================================
  49. Removing:
  50.  mysql-libs x86_64 5.1.66-2.el6_3 @anaconda-OracleLinuxServer-201302251503.x86_64/6.4 4.0 M
  51. Removing for dependencies:
  52.  cronie x86_64 1.4.4-7.el6 @anaconda-OracleLinuxServer-201302251503.x86_64/6.4 166 k
  53.  cronie-anacron x86_64 1.4.4-7.el6 @anaconda-OracleLinuxServer-201302251503.x86_64/6.4 43 k
  54.  crontabs noarch 1.10-33.el6 @anaconda-OracleLinuxServer-201302251503.x86_64/6.4 2.4 k
  55.  mysql x86_64 5.1.66-2.el6_3 @anaconda-OracleLinuxServer-201302251503.x86_64/6.4 2.4 M
  56.  mysql-devel x86_64 5.1.66-2.el6_3 @anaconda-OracleLinuxServer-201302251503.x86_64/6.4 387 k
  57.  postfix x86_64 2:2.6.6-2.2.el6_1 @anaconda-OracleLinuxServer-201302251503.x86_64/6.4 9.7 M
  58.  redhat-lsb x86_64 4.0-7.0.1.el6 @anaconda-OracleLinuxServer-201302251503.x86_64/6.4 0.0
  59.  redhat-lsb-compat x86_64 4.0-7.0.1.el6 @anaconda-OracleLinuxServer-201302251503.x86_64/6.4 0.0
  60.  redhat-lsb-core x86_64 4.0-7.0.1.el6 @anaconda-OracleLinuxServer-201302251503.x86_64/6.4 22 k
  61.  redhat-lsb-graphics x86_64 4.0-7.0.1.el6 @anaconda-OracleLinuxServer-201302251503.x86_64/6.4 0.0
  62.  redhat-lsb-printing x86_64 4.0-7.0.1.el6 @anaconda-OracleLinuxServer-201302251503.x86_64/6.4 0.0
  63.  sysstat x86_64 9.0.4-20.el6 @anaconda-OracleLinuxServer-201302251503.x86_64/6.4 807 k

  64. Transaction Summary
  65. ============================================================================================================================================================
  66. Remove 13 Package(s)

  67. Installed size: 17 M
  68. Downloading Packages:
  69. Running rpm_check_debug
  70. Running Transaction Test
  71. Transaction Test Succeeded
  72. Running Transaction
  73.   Erasing : redhat-lsb-compat-4.0-7.0.1.el6.x86_64 1/13
  74.   Erasing : redhat-lsb-4.0-7.0.1.el6.x86_64 2/13
  75.   Erasing : mysql-devel-5.1.66-2.el6_3.x86_64 3/13
  76.   Erasing : redhat-lsb-graphics-4.0-7.0.1.el6.x86_64 4/13
  77.   Erasing : redhat-lsb-printing-4.0-7.0.1.el6.x86_64 5/13
  78.   Erasing : redhat-lsb-core-4.0-7.0.1.el6.x86_64 6/13
  79.   Erasing : mysql-5.1.66-2.el6_3.x86_64 7/13
  80. /var/tmp/rpm-tmp.aSJ8EY: line 1: lsb_release: command not found
  81.   Erasing : sysstat-9.0.4-20.el6.x86_64 8/13
  82.   Erasing : crontabs-1.10-33.el6.noarch 9/13
  83.   Erasing : cronie-anacron-1.4.4-7.el6.x86_64 10/13
  84.   Erasing : cronie-1.4.4-7.el6.x86_64 11/13
  85.   Erasing : 2:postfix-2.6.6-2.2.el6_1.x86_64 12/13
  86.   Erasing : mysql-libs-5.1.66-2.el6_3.x86_64 13/13
  87.   Verifying : mysql-devel-5.1.66-2.el6_3.x86_64 1/13
  88.   Verifying : redhat-lsb-printing-4.0-7.0.1.el6.x86_64 2/13
  89.   Verifying : 2:postfix-2.6.6-2.2.el6_1.x86_64 3/13
  90.   Verifying : redhat-lsb-4.0-7.0.1.el6.x86_64 4/13
  91.   Verifying : redhat-lsb-core-4.0-7.0.1.el6.x86_64 5/13
  92.   Verifying : mysql-5.1.66-2.el6_3.x86_64 6/13
  93.   Verifying : cronie-anacron-1.4.4-7.el6.x86_64 7/13
  94.   Verifying : redhat-lsb-compat-4.0-7.0.1.el6.x86_64 8/13
  95.   Verifying : crontabs-1.10-33.el6.noarch 9/13
  96.   Verifying : sysstat-9.0.4-20.el6.x86_64 10/13
  97.   Verifying : mysql-libs-5.1.66-2.el6_3.x86_64 11/13
  98.   Verifying : cronie-1.4.4-7.el6.x86_64 12/13
  99.   Verifying : redhat-lsb-graphics-4.0-7.0.1.el6.x86_64 13/13

  100. Removed:
  101.   mysql-libs.x86_64 0:5.1.66-2.el6_3

  102. Dependency Removed:
  103.   cronie.x86_64 0:1.4.4-7.el6 cronie-anacron.x86_64 0:1.4.4-7.el6 crontabs.noarch 0:1.10-33.el6
  104.   mysql.x86_64 0:5.1.66-2.el6_3 mysql-devel.x86_64 0:5.1.66-2.el6_3 postfix.x86_64 2:2.6.6-2.2.el6_1
  105.   redhat-lsb.x86_64 0:4.0-7.0.1.el6 redhat-lsb-compat.x86_64 0:4.0-7.0.1.el6 redhat-lsb-core.x86_64 0:4.0-7.0.1.el6
  106.   redhat-lsb-graphics.x86_64 0:4.0-7.0.1.el6 redhat-lsb-printing.x86_64 0:4.0-7.0.1.el6 sysstat.x86_64 0:9.0.4-20.el6

  107. Complete!
我这里用的虚拟机是两块网卡,一块host-only,一块NAT,加了NAT以后就可以使用yum的方式去解决冲突了。
然后继续安装
  1. [root@Hadoop mysql]# rpm -ivh MySQL-server-5.6.20-1.el6.x86_64.rpm
  2. Preparing... ########################################### [100%]
  3.    1:MySQL-server ########################################### [100%]
  4. 2016-05-30 11:07:08 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
  5. 2016-05-30 11:07:08 2893 [Note] InnoDB: Using atomics to ref count buffer pool pages
  6. 2016-05-30 11:07:08 2893 [Note] InnoDB: The InnoDB memory heap is disabled
  7. 2016-05-30 11:07:08 2893 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
  8. 2016-05-30 11:07:08 2893 [Note] InnoDB: Memory barrier is not used
  9. 2016-05-30 11:07:08 2893 [Note] InnoDB: Compressed tables use zlib 1.2.3
  10. 2016-05-30 11:07:08 2893 [Note] InnoDB: Using Linux native AIO
  11. 2016-05-30 11:07:08 2893 [Note] InnoDB: Using CPU crc32 instructions
  12. 2016-05-30 11:07:08 2893 [Note] InnoDB: Initializing buffer pool, size = 128.0M
  13. 2016-05-30 11:07:08 2893 [Note] InnoDB: Completed initialization of buffer pool
  14. 2016-05-30 11:07:08 2893 [Note] InnoDB: The first specified data file ./ibdata1 did not exist: a new database to be created!
  15. 2016-05-30 11:07:08 2893 [Note] InnoDB: Setting file ./ibdata1 size to 12 MB
  16. 2016-05-30 11:07:08 2893 [Note] InnoDB: Database physically writes the file full: wait...
  17. 2016-05-30 11:07:08 2893 [Note] InnoDB: Setting log file ./ib_logfile101 size to 48 MB
  18. 2016-05-30 11:07:10 2893 [Note] InnoDB: Setting log file ./ib_logfile1 size to 48 MB
  19. 2016-05-30 11:07:11 2893 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0
  20. 2016-05-30 11:07:11 2893 [Warning] InnoDB: New log files created, LSN=45781
  21. 2016-05-30 11:07:11 2893 [Note] InnoDB: Doublewrite buffer not found: creating new
  22. 2016-05-30 11:07:11 2893 [Note] InnoDB: Doublewrite buffer created
  23. 2016-05-30 11:07:11 2893 [Note] InnoDB: 128 rollback segment(s) are active.
  24. 2016-05-30 11:07:11 2893 [Warning] InnoDB: Creating foreign key constraint system tables.
  25. 2016-05-30 11:07:11 2893 [Note] InnoDB: Foreign key constraint system tables created
  26. 2016-05-30 11:07:11 2893 [Note] InnoDB: Creating tablespace and datafile system tables.
  27. 2016-05-30 11:07:11 2893 [Note] InnoDB: Tablespace and datafile system tables created.
  28. 2016-05-30 11:07:11 2893 [Note] InnoDB: Waiting for purge to start
  29. 2016-05-30 11:07:11 2893 [Note] InnoDB: 5.6.20 started; log sequence number 0
  30. A random root password has been set. You will find it in '/root/.mysql_secret'.
  31. 2016-05-30 11:07:12 2893 [Note] Binlog end
  32. 2016-05-30 11:07:12 2893 [Note] InnoDB: FTS optimize thread exiting.
  33. 2016-05-30 11:07:12 2893 [Note] InnoDB: Starting shutdown...
  34. 2016-05-30 11:07:13 2893 [Note] InnoDB: Shutdown completed; log sequence number 1625977


  35. 2016-05-30 11:07:13 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
  36. 2016-05-30 11:07:13 2915 [Note] InnoDB: Using atomics to ref count buffer pool pages
  37. 2016-05-30 11:07:13 2915 [Note] InnoDB: The InnoDB memory heap is disabled
  38. 2016-05-30 11:07:13 2915 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
  39. 2016-05-30 11:07:13 2915 [Note] InnoDB: Memory barrier is not used
  40. 2016-05-30 11:07:13 2915 [Note] InnoDB: Compressed tables use zlib 1.2.3
  41. 2016-05-30 11:07:13 2915 [Note] InnoDB: Using Linux native AIO
  42. 2016-05-30 11:07:13 2915 [Note] InnoDB: Using CPU crc32 instructions
  43. 2016-05-30 11:07:13 2915 [Note] InnoDB: Initializing buffer pool, size = 128.0M
  44. 2016-05-30 11:07:13 2915 [Note] InnoDB: Completed initialization of buffer pool
  45. 2016-05-30 11:07:13 2915 [Note] InnoDB: Highest supported file format is Barracuda.
  46. 2016-05-30 11:07:13 2915 [Note] InnoDB: 128 rollback segment(s) are active.
  47. 2016-05-30 11:07:13 2915 [Note] InnoDB: Waiting for purge to start
  48. 2016-05-30 11:07:13 2915 [Note] InnoDB: 5.6.20 started; log sequence number 1625977
  49. 2016-05-30 11:07:14 2915 [Note] Binlog end
  50. 2016-05-30 11:07:14 2915 [Note] InnoDB: FTS optimize thread exiting.
  51. 2016-05-30 11:07:14 2915 [Note] InnoDB: Starting shutdown...
  52. 2016-05-30 11:07:15 2915 [Note] InnoDB: Shutdown completed; log sequence number 1625987




  53. A RANDOM PASSWORD HAS BEEN SET FOR THE MySQL root USER !
  54. You will find that password in '/root/.mysql_secret'.

  55. You must change that password on your first connect,
  56. no other statement but 'SET PASSWORD' will be accepted.
  57. See the manual for the semantics of the 'password expired' flag.

  58. Also, the account for the anonymous user has been removed.

  59. In addition, you can run:

  60.   /usr/bin/mysql_secure_installation

  61. which will also give you the option of removing the test database.
  62. This is strongly recommended for production servers.

  63. See the manual for more instructions.

  64. Please report any problems at http://bugs.mysql.com/

  65. The latest information about MySQL is available on the web at

  66.   http://www.mysql.com

  67. Support MySQL by buying support/licenses at http://shop.mysql.com

  68. New default config file was created as /usr/my.cnf and
  69. will be used by default by the server when you start it.
  70. You may edit this file to change server settings
  1. [root@Hadoop mysql]# rpm -ivh MySQL-client-5.6.20-1.el6.x86_64.rpm
  2. Preparing... ########################################### [100%]
  3.    1:MySQL-client ########################################### [100%]
  1. [root@Hadoop mysql]# rpm -ivh MySQL-devel-5.6.20-1.el6.x86_64.rpm
  2. Preparing... ########################################### [100%]
  3.    1:MySQL-devel ########################################### [100%]
安装完成后启动mysql服务
  1. [root@Hadoop mysql]# service mysql start
  2. Starting MySQL. SUCCESS!
查看root的随机密码
  1. [root@Hadoop ~]# cat /root/.mysql_secret
  2. # The random password set for the root user at Mon May 30 11:07:12 2016 (local time): wSerJnbKa2UxlRqR
登陆mysql

  1. [root@Hadoop bin]# mysql -u root -pwSerJnbKa2UxlRqR
  2. Warning: Using a password on the command line interface can be insecure.
  3. Welcome to the MySQL monitor. Commands end with ; or \g.
  4. Your MySQL connection id is 5
  5. Server version: 5.6.20

  6. Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.

  7. Oracle is a registered trademark of Oracle Corporation and/or its
  8. affiliates. Other names may be trademarks of their respective
  9. owners.

  10. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

  11. mysql>
修改密码
  1. mysql> UPDATE user SET Password=PASSWORD('root') where USER='root';
  2. Query OK, 4 rows affected (0.00 sec)
  3. Rows matched: 4 Changed: 4 Warnings: 0

  4. mysql> FLUSH PRIVILEGES;
  5. Query OK, 0 rows affected (0.00 sec)
设置远程登陆 方法1:
  1. mysql>use mysql;
  2. mysql>update user set host = '%' where user = 'root';
  3. mysql> select host,user from user;
  4. +-----------+------+
  5. | host | user |
  6. +-----------+------+
  7. | % | root |
  8. | 127.0.0.1 | root |
  9. | ::1 | root |
  10. | hadoop | root |
  11. +-----------+------+
  12. 4 rows in set (0.00 sec)
方法2:
  1. GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'youpassword' WITH GRANT OPTIO
之后就可以尝试远程登陆,果然就成功率
  1. C:\Users\lnwxzyp>mysql -uroot -proot -h192.168.56.101
  2. Warning: Using a password on the command line interface can be insecure.
  3. Welcome to the MySQL monitor. Commands end with ; or \g.
  4. Your MySQL connection id is 2
  5. Server version: 5.6.20 MySQL Community Server (GPL)

  6. Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.

  7. Oracle is a registered trademark of Oracle Corporation and/or its
  8. affiliates. Other names may be trademarks of their respective
  9. owners.

  10. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

  11. mysql>
在安装过程中,由于在修改了密码之后没有刷新权限,并且对mysql进行了重启,结果造成登陆的时候出现 如下错误
  1. [root@Hadoop bin]# mysql -uroot -p
  2. Enter password:
  3. ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
这种情况下,需要设置跳过验证表
  1. [root@Hadoop bin]# mysqld_safe --skip-grant-tables
  2. 160530 14:28:31 mysqld_safe Logging to '/var/lib/mysql/Hadoop.err'.
  3. 160530 14:28:32 mysqld_safe A mysqld process already exists
然后就可以 mysql -u root mysql 方式登陆了,另外开一个终端
  1. [root@Hadoop ~]# mysql -u root mysql
  2. Reading table information for completion of table and column names
  3. You can turn off this feature to get a quicker startup with -A

  4. Welcome to the MySQL monitor. Commands end with ; or \g.
  5. Your MySQL connection id is 2
  6. Server version: 5.6.20 MySQL Community Server (GPL)

  7. Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.

  8. Oracle is a registered trademark of Oracle Corporation and/or its
  9. affiliates. Other names may be trademarks of their respective
  10. owners.

  11. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

  12. mysql> UPDATE user SET Password=PASSWORD('root') where USER='root';
  13. Query OK, 4 rows affected (0.00 sec)
  14. Rows matched: 4 Changed: 4 Warnings: 0

  15. mysql> FLUSH PRIVILEGES;
  16. Query OK, 0 rows affected (0.00 sec)

  17. mysql> quit;
  18. Bye
  19. [root@Hadoop ~]#
然后重启mysql之后就正常了。










来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/12216142/viewspace-2109266/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2008-04-25

  • 博文量
    129
  • 访问量
    673957