设为首页 收藏本站
查看: 1116|回复: 0

[经验分享] mysql 5.6_38 linux 安装

[复制链接]

尚未签到

发表于 2017-11-17 14:50:53 | 显示全部楼层 |阅读模式
删除老版本:
查看安装包:
[iyunv@centos1 opt]# rpm -qa | grep -i mysql

  mysql-libs-5.1.73-7.el6.x86_64
  mysql-server-5.1.73-7.el6.x86_64
  zabbix-server-mysql-2.4.8-1.el6.x86_64
  perl-DBD-MySQL-4.013-3.el6.x86_64
  mysql-devel-5.1.73-7.el6.x86_64
  php-mysql-5.3.3-48.el6_8.x86_64
  zabbix-web-mysql-2.4.8-1.el6.noarch
  mysql-5.1.73-7.el6.x86_64
[iyunv@centos1 opt]#

关闭mysql服务:
[iyunv@centos1 opt]# /etc/init.d/mysqld  stop

  Stopping mysqld:                                           [  OK  ]
[iyunv@centos1 opt]#

[iyunv@centos1 opt]#  chkconfig --list | grep -i mysql

  mysqld            0:off 1:off 2:off 3:off 4:off 5:off 6:off
[iyunv@centos1 opt]#

  收集mysql对应的文件夹信息:
[iyunv@centos1 opt]# whereis mysql

  mysql: /usr/bin/mysql /usr/lib64/mysql /usr/include/mysql /usr/share/mysql /usr/share/man/man1/mysql.1.gz
[iyunv@centos1 opt]#

[iyunv@centos1 opt]# find / -name mysql

  /usr/lib64/perl5/DBD/mysql
  /usr/lib64/perl5/auto/DBD/mysql
  /usr/lib64/mysql
  /usr/share/doc/zabbix-server-mysql-2.4.8/upgrades/dbpatches/2.0/mysql
  /usr/share/doc/zabbix-server-mysql-2.4.8/upgrades/dbpatches/1.6/mysql
  /usr/share/doc/zabbix-server-mysql-2.4.8/upgrades/dbpatches/1.8/mysql
  /usr/share/mysql
  /usr/include/mysql
  /usr/bin/mysql
  /var/lib/mysql
  /var/lib/mysql/mysql
[iyunv@centos1 opt]#

删除rpm:
[iyunv@centos1 opt]# rpm -ev  mysql-devel-5.1.73-7.el6.x86_64

[iyunv@centos1 opt]#  rpm -ev  mysql-server-5.1.73-7.el6.x86_64

  warning: /var/log/mysqld.log saved as /var/log/mysqld.log.rpmsave
[iyunv@centos1 opt]# rpm -ev  mysql-5.1.73-7.el6.x86_64

  删除文件夹:
[iyunv@centos1 opt]# rm -rf /var/lib/mysql/

[iyunv@centos1 opt]# rm -rf /usr/lib64/mysql/

[iyunv@centos1 opt]#

  删除用户:
[iyunv@centos1 opt]# userdel -r mysql

  userdel: mysql mail spool (/var/spool/mail/mysql) not found
  userdel: mysql home directory (/var/lib/mysql) not found
[iyunv@centos1 opt]#

安装:
创建用户:
[iyunv@mysql5 ~]# groupadd mysql

[iyunv@mysql5 ~]# useradd -r -g mysql mysql

  解压软件:
[iyunv@centos1 opt]# cp mysql-5.6.38-linux-glibc2.12-x86_64.tar.gz  /usr/local/

[iyunv@centos1 local]# tar -zxvf mysql-5.6.38-linux-glibc2.12-x86_64.tar.gz

[iyunv@centos1 local]# mv mysql-5.6.38-linux-glibc2.12-x86_64 mysql5.638

  修改权限:
[iyunv@centos1 local]# chown -R mysql:mysql mysql5.638/

  初始化数据库:
[iyunv@centos1 mysql5.638]# cd scripts/

[iyunv@centos1 scripts]# ll

  total 36
  -rwxr-xr-x 1 mysql mysql 34558 Sep 14 00:24 mysql_install_db
[iyunv@centos1 scripts]#

[iyunv@centos1 scripts]# ./mysql_install_db --user=mysql --basedir=/usr/local/mysql5.638/ --datadir=/data/mysql5630/data/

  WARNING: The host 'centos1' could not be looked up with /usr/local/mysql5.638//bin/resolveip.
  This probably means that your libc libraries are not 100 % compatible
  with this binary MySQL version. The MySQL daemon, mysqld, should work
  normally with the exception that host name resolving will not work.
  This means that you should use IP addresses instead of hostnames
  when specifying MySQL privileges !
  Installing MySQL system tables...2017-10-19 22:58:01 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
  2017-10-19 22:58:01 0 [Note] Ignoring --secure-file-priv value as server is running with --bootstrap.
  2017-10-19 22:58:01 0 [Note] /usr/local/mysql5.638//bin/mysqld (mysqld 5.6.38) starting as process 5797 ...
  2017-10-19 22:58:01 5797 [Note] InnoDB: Using atomics to ref count buffer pool pages
  2017-10-19 22:58:01 5797 [Note] InnoDB: The InnoDB memory heap is disabled
  2017-10-19 22:58:01 5797 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
  2017-10-19 22:58:01 5797 [Note] InnoDB: Memory barrier is not used
  2017-10-19 22:58:01 5797 [Note] InnoDB: Compressed tables use zlib 1.2.3
  2017-10-19 22:58:01 5797 [Note] InnoDB: Using Linux native AIO
  2017-10-19 22:58:01 5797 [Note] InnoDB: Using CPU crc32 instructions
  2017-10-19 22:58:01 5797 [Note] InnoDB: Initializing buffer pool, size = 128.0M
  2017-10-19 22:58:01 5797 [Note] InnoDB: Completed initialization of buffer pool
  2017-10-19 22:58:01 5797 [Note] InnoDB: The first specified data file ./ibdata1 did not exist: a new database to be created!
  2017-10-19 22:58:01 5797 [Note] InnoDB: Setting file ./ibdata1 size to 12 MB
  2017-10-19 22:58:01 5797 [Note] InnoDB: Database physically writes the file full: wait...
  2017-10-19 22:58:02 5797 [Note] InnoDB: Setting log file ./ib_logfile101 size to 48 MB
  2017-10-19 22:58:03 5797 [Note] InnoDB: Setting log file ./ib_logfile1 size to 48 MB
  2017-10-19 22:58:05 5797 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0
  2017-10-19 22:58:05 5797 [Warning] InnoDB: New log files created, LSN=45781
  2017-10-19 22:58:05 5797 [Note] InnoDB: Doublewrite buffer not found: creating new
  2017-10-19 22:58:05 5797 [Note] InnoDB: Doublewrite buffer created
  2017-10-19 22:58:05 5797 [Note] InnoDB: 128 rollback segment(s) are active.
  2017-10-19 22:58:05 5797 [Warning] InnoDB: Creating foreign key constraint system tables.
  2017-10-19 22:58:05 5797 [Note] InnoDB: Foreign key constraint system tables created
  2017-10-19 22:58:05 5797 [Note] InnoDB: Creating tablespace and datafile system tables.
  2017-10-19 22:58:05 5797 [Note] InnoDB: Tablespace and datafile system tables created.
  2017-10-19 22:58:05 5797 [Note] InnoDB: Waiting for purge to start
  2017-10-19 22:58:05 5797 [Note] InnoDB: 5.6.38 started; log sequence number 0
  2017-10-19 22:58:06 5797 [Note] Binlog end
  2017-10-19 22:58:06 5797 [Note] InnoDB: FTS optimize thread exiting.
  2017-10-19 22:58:06 5797 [Note] InnoDB: Starting shutdown...
  2017-10-19 22:58:07 5797 [Note] InnoDB: Shutdown completed; log sequence number 1625977
  OK
  Filling help tables...2017-10-19 22:58:07 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
  2017-10-19 22:58:07 0 [Note] Ignoring --secure-file-priv value as server is running with --bootstrap.
  2017-10-19 22:58:07 0 [Note] /usr/local/mysql5.638//bin/mysqld (mysqld 5.6.38) starting as process 5819 ...
  2017-10-19 22:58:07 5819 [Note] InnoDB: Using atomics to ref count buffer pool pages
  2017-10-19 22:58:07 5819 [Note] InnoDB: The InnoDB memory heap is disabled
  2017-10-19 22:58:07 5819 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
  2017-10-19 22:58:07 5819 [Note] InnoDB: Memory barrier is not used
  2017-10-19 22:58:07 5819 [Note] InnoDB: Compressed tables use zlib 1.2.3
  2017-10-19 22:58:07 5819 [Note] InnoDB: Using Linux native AIO
  2017-10-19 22:58:07 5819 [Note] InnoDB: Using CPU crc32 instructions
  2017-10-19 22:58:07 5819 [Note] InnoDB: Initializing buffer pool, size = 128.0M
  2017-10-19 22:58:07 5819 [Note] InnoDB: Completed initialization of buffer pool
  2017-10-19 22:58:07 5819 [Note] InnoDB: Highest supported file format is Barracuda.
  2017-10-19 22:58:07 5819 [Note] InnoDB: 128 rollback segment(s) are active.
  2017-10-19 22:58:07 5819 [Note] InnoDB: Waiting for purge to start
  2017-10-19 22:58:07 5819 [Note] InnoDB: 5.6.38 started; log sequence number 1625977
  2017-10-19 22:58:07 5819 [Note] Binlog end
  2017-10-19 22:58:07 5819 [Note] InnoDB: FTS optimize thread exiting.
  2017-10-19 22:58:07 5819 [Note] InnoDB: Starting shutdown...
  2017-10-19 22:58:09 5819 [Note] InnoDB: Shutdown completed; log sequence number 1625987
  OK
  To start mysqld at boot time you have to copy
  support-files/mysql.server to the right place for your system
  PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
  To do so, start the server, then issue the following commands:
  /usr/local/mysql5.638//bin/mysqladmin -u root password 'new-password'
  /usr/local/mysql5.638//bin/mysqladmin -u root -h centos1 password 'new-password'
  Alternatively you can run:
  /usr/local/mysql5.638//bin/mysql_secure_installation
  which will also give you the option of removing the test
  databases and anonymous user created by default.  This is
  strongly recommended for production servers.
  See the manual for more instructions.
  You can start the MySQL daemon with:
  cd . ; /usr/local/mysql5.638//bin/mysqld_safe &
  You can test the MySQL daemon with mysql-test-run.pl
  cd mysql-test ; perl mysql-test-run.pl
  Please report any problems at http://bugs.mysql.com/
  The latest information about MySQL is available on the web at
  http://www.mysql.com
  Support MySQL by buying support/licenses at http://shop.mysql.com
  New default config file was created as /usr/local/mysql5.638//my.cnf and
  will be used by default by the server when you start it.
  You may edit this file to change server settings
  WARNING: Default config file /etc/my.cnf exists on the system
  This file will be read by default by the MySQL server
  If you do not want to use this, either remove it, or use the
  --defaults-file argument to mysqld_safe when starting the server
[iyunv@centos1 scripts]#

配置文件:
[iyunv@centos1 scripts]# cd /usr/local/mysql5.638/support-files

  #cp my-default.cnf /etc/my.cnf
  cp mysql.server /etc/init.d/mysql
  #my.cnf
[client]

  port            = 3306
  socket          = /tmp/mysql.sock
[mysql]

  prompt="\\u@\\h [\\d]>"
  #pager="less -i -n -S"
  #tee=/opt/mysql/query.log
  no-auto-rehash
[mysqld]

  #misc
  user = mysql
  basedir = /usr/local/mysql5.638
  datadir = /data/mysql5630/data
  port = 3306
  socket = /tmp/mysql3306.sock
  event_scheduler = 0
  tmpdir = /data/mysql5630/tmp
  #timeout
  interactive_timeout = 300
  wait_timeout = 300
  #character set
  character-set-server = utf8
  open_files_limit = 65535
  max_connections = 100
  max_connect_errors = 100000
  lower_case_table_names =1
  #symi replication
  #rpl_semi_sync_master_enabled=1
  #rpl_semi_sync_master_timeout=1000 # 1 second
  #rpl_semi_sync_slave_enabled=1
  #logs
  log-output=file
  slow_query_log = 1
  slow_query_log_file = slow.log
  log-error = error.log
  log_warnings = 2
  pid-file = mysql.pid
  long_query_time = 1
  #log-slow-admin-statements = 1
  #log-queries-not-using-indexes = 1
  log-slow-slave-statements = 1
  #binlog
  #binlog_format = STATEMENT
  binlog_format = row
  server-id = 1003306
  log-bin = /data/mysql5630/logs/mysql-bin
  max_binlog_size = 256M
  sync_binlog = 0
  expire_logs_days = 10
  #procedure
  log_bin_trust_function_creators=1
  #
  gtid-mode = on
  enforce-gtid-consistency=1
  #relay log
  skip_slave_start = 1
  max_relay_log_size = 128M
  relay_log_purge = 1
  relay_log_recovery = 1
  relay-log=relay-bin
  relay-log-index=relay-bin.index
  log_slave_updates
  #slave-skip-errors=1032,1053,1062
  #skip-grant-tables
  #buffers & cache
  table_open_cache = 2048
  table_definition_cache = 2048
  table_open_cache = 2048
  max_heap_table_size = 96M
  sort_buffer_size = 128K
  join_buffer_size = 128K
  thread_cache_size = 200
  query_cache_size = 0
  query_cache_type = 0
  query_cache_limit = 256K
  query_cache_min_res_unit = 512
  thread_stack = 192K
  tmp_table_size = 96M
  key_buffer_size = 8M
  read_buffer_size = 2M
  read_rnd_buffer_size = 16M
  bulk_insert_buffer_size = 32M
  #myisam
  myisam_sort_buffer_size = 128M
  myisam_max_sort_file_size = 10G
  myisam_repair_threads = 1
  #innodb
  innodb_buffer_pool_size = 100M
  innodb_buffer_pool_instances = 1
  innodb_data_file_path = ibdata1:100M:autoextend
  innodb_flush_log_at_trx_commit = 2
  innodb_log_buffer_size = 8M
  innodb_log_file_size = 100M
  innodb_log_files_in_group = 3
  innodb_max_dirty_pages_pct = 50
  innodb_file_per_table = 1
  innodb_rollback_on_timeout
  innodb_io_capacity = 2000
  transaction_isolation = READ-COMMITTED
  innodb_flush_method = O_DIRECT
配置环境变量
  vim /etc/profile
  export MYSQL_HOME="/software/mysql-5.6.21"
  export PATH="$PATH:$MYSQL_HOME/bin"
  保存退出
  . /etc/profile
  启动mysql:
[iyunv@centos1 local]# cd /usr/local/mysql5.638/support-files/

[iyunv@centos1 support-files]# cp mysql.server  /etc/init.d/mysql

[iyunv@centos1 support-files]#

[iyunv@centos1 ~]# /etc/init.d/mysql  start

  Starting MySQL..                                           [  OK  ]
[iyunv@centos1 ~]#

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-407916-1-1.html 上篇帖子: linux安装nginx与php 下篇帖子: linux 基础知识及命令总结
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表