In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article will explain in detail how to achieve offline installation of mysql in linux. The editor thinks it is very practical, so I share it with you for reference. I hope you can get something after reading this article.
[root@hadoop-01 ~] # cd / usr/local
[root@hadoop-01 local] # wget https://downloads.mariadb.com/archives/mysql-5.6/mysql-5.6.23-linux-glibc2.5-x86_64.tar.gz
[root@hadoop-01 local] # wget https://downloads.mariadb.com/archives/mysql-5.6/mysql-5.6.23-linux-glibc2.5-x86_64.tar.gz.md5
[root@hadoop-01 local] # vi mysql-5.6.23-linux-glibc2.5-x86_64.tar.gz.md5
61affe944eff55fcf51b31e67f25dc10 mysql-5.6.23-linux-glibc2.5-x86_64.tar.gz
[root@hadoop-01 local] # md5sum mysql-5.6.23-linux-glibc2.5-x86_64.tar.gz
61affe944eff55fcf51b31e67f25dc10 mysql-5.6.23-linux-glibc2.5-x86_64.tar.gz
Check if it is installed
[root@hadoop-01 local] # ps-ef | grep mysqld
Decompress and rename
[root@hadoop-01 local] # tar xzvf mysql-5.6.23-linux-glibc2.5-x86_64.tar.gz
[root@hadoop-01 local] # mv mysql-5.6.23-linux-glibc2.5-x86_64 mysql
Create a user group
[root@hadoop-01 local] # groupadd-g 101 dba
[root@hadoop-01 local] # useradd-u 514-g dba-G root-d / usr/local/mysql mysqladmin
[root@hadoop-01 local] # id mysqladmin
Uid=514 (mysqladmin) gid=101 (dba) groups=101 (dba), 0 (root)
[root@hadoop-01 local] # passwd mysqladmin
# copy environment variable configuration file to the home directory of mysqladmin users, configure personal environment variables for the following steps
[root@hadoop-01 local] # cp / etc/skel/.* / usr/local/mysql
Create profile / etc/my.cnf (640)
[root@hadoop-01 mysql] # vi / etc/my.cnf
Delete the content and copy the following
[client]
Port = 3306
Socket = / usr/local/mysql/data/mysql.sock
[mysqld]
Port = 3306
Socket = / usr/local/mysql/data/mysql.sock
Skip-external-locking
Key_buffer_size = 256m
Sort_buffer_size = 2m
Read_buffer_size = 2m
Read_rnd_buffer_size = 4m
Query_cache_size= 32M
Max_allowed_packet = 16m
Myisam_sort_buffer_size=128M
Tmp_table_size=32M
Table_open_cache = 512
Thread_cache_size = 8
Wait_timeout = 86400
Interactive_timeout = 86400
Max_connections = 600,
# Try number of CPU's*2 for thread_concurrency
Thread_concurrency = 32
# isolation level and default engine
Default-storage-engine = INNODB
Transaction-isolation = READ-COMMITTED
Server-id = 1
Basedir = / usr/local/mysql
Datadir = / usr/local/mysql/data
Pid-file = / usr/local/mysql/data/hostname.pid
# open performance schema
Log-warnings
Sysdate-is-now
Binlog_format = MIXED
Log_bin_trust_function_creators=1
Log-error = / usr/local/mysql/data/hostname.err
Log-bin=/usr/local/mysql/arch/mysql-bin
# other logs
# general_log = 1
# general_log_file = / usr/local/mysql/data/general_log.err
# slow_query_log=1
# slow_query_log_file=/usr/local/mysql/data/slow_log.err
# for replication slave
# log-slave-updates
# sync_binlog = 1
# for innodb options
Innodb_data_home_dir = / usr/local/mysql/data/
Innodb_data_file_path = ibdata1:500M:autoextend
Innodb_log_group_home_dir = / usr/local/mysql/arch
Innodb_log_files_in_group = 2
Innodb_log_file_size = 200m
# rember change
Innodb_buffer_pool_size = 2048m
Innodb_additional_mem_pool_size = 50m
Innodb_log_buffer_size = 16m
Innodb_lock_wait_timeout = 100
# innodb_thread_concurrency = 0
Innodb_flush_log_at_trx_commit = 1
Innodb_locks_unsafe_for_binlog=1
# innodb io features: add for mysql5.5.8
Performance_schema
Innodb_read_io_threads=4
Innodb-write-io-threads=4
Innodb-io-capacity=200
# purge threads change default (0) to 1 for purge
Innodb_purge_threads=1
Innodb_use_native_aio=on
# case-sensitive file names and separate tablespace
Innodb_file_per_table = 1
Lower_case_table_names=1
[mysqldump]
Quick
Max_allowed_packet = 16m
[mysql]
No-auto-rehash
[mysqlhotcopy]
Interactive-timeout
[myisamchk]
Key_buffer_size = 256m
Sort_buffer_size = 256m
Read_buffer = 2m
Write_buffer = 2m
Specify file user group, modify permissions, attempt to install for the first time
[root@hadoop-01 local] # chown mysqladmin:dba / etc/my.cnf
[root@hadoop-01 local] # chmod 640 / etc/my.cnf
[root@hadoop-01 etc] # ll my.cnf
-rw-r- 1 mysqladmin dba 2201 Aug 25 23:09 my.cnf
[root@hadoop-01 local] # chown-R mysqladmin:dba / usr/local/mysql
[root@hadoop-01 local] # chmod-R 755 / usr/local/mysql
[root@hadoop-01 local] # su-mysqladmin
[mysqladmin@hadoop-01 ~] # pwd
/ usr/local/mysql
[mysqladmin@hadoop-01 ~] # mkdir arch
[mysqladmin@hadoop-01 ~] # scripts/mysql_install_db # import
Installing MySQL system tables..../bin/mysqld: error while loading shared libraries: libaio.so.1: cannot open shared object file: No such file or directory # missing libaio.so package
[root@hadoop-01 local] # yum-y install libaio
Install again
[mysqladmin@hadoop-01] # scripts/mysql_install_db-user=mysqladmin-basedir=/usr/local/mysql-datadir=/usr/local/mysql/data
Configure mysql service self-startup
[root@sht-sgmhadoopnn-01 ~] # cd / usr/local/mysql
# copy the service file to init.d and rename it to mysql
[root@sht-sgmhadoopnn-01 mysql] # cp support-files/mysql.server / etc/rc.d/init.d/mysql
# Grant executable permissions
[root@sht-sgmhadoopnn-01 mysql] # chmod + x / etc/rc.d/init.d/mysql
# deleting a service
[root@sht-sgmhadoopnn-01 mysql] # chkconfig-- del mysql
# add Services
[root@sht-sgmhadoopnn-01 mysql] # chkconfig-- add mysql
[root@sht-sgmhadoopnn-01 mysql] # chkconfig-- level 345 mysql on
[root@sht-sgmhadoopnn-01 mysql] # vi / etc/rc.local
#! / bin/sh
#
# This script will be executed * after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.
Touch / var/lock/subsys/local
Su-mysqladmin-c "/ etc/init.d/mysql start-- federated"
"/ etc/rc.local" 9L, 278C written
View the process
[root@hadoop-01 mysql] # su-mysqladmin
[mysqladmin@hadoop-01 ~] # pwd
/ usr/local/mysql
[mysqladmin@hadoop-01 ~] # rm-rf my.cnf
[mysqladmin@hadoop-01 ~] # bin/mysqld_safe &
[mysqladmin@hadoop-01 ~] # ps-ef | grep mysqld
[mysqladmin@hadoop-01 ~] # netstat-tulnp | grep mysql
[root@hadoop-01 local] # service mysql status
Log in to mysql
[mysqladmin@hadoop-01 ~] # bin/mysql
Mysql > show databases
+-+
| | Database |
+-+
| | information_schema |
| | mysql |
| | performance_schema |
| | test |
+-+
Modify the password
Mysql > use mysql
Mysql > update user set password=password ('password') where user='root'
Configure environment variables
[mysqladmin@hadoop-01 ~] $vi. / .bash _ profile
# insert
Export MYSQL_HOME=/usr/local/mysql
Export PATH=$ {MYSQL_HOME} / bin:$PATH
[mysqladmin@hadoop-01 ~] $source. / .bash _ profile
[mysqladmin@hadoop-01 ~] $vi. / .bash _ profile
Implement window and other tools to remotely connect to the linux server
1. Log in to MySQL database
Mysql-u root-p
View the user table
Mysql > use mysql
Database changed
Mysql > select host,user,password from user
+-- +
| | host | user | password | |
+-- +
| | localhost | root | * A731AEBFB621E354CD41BAF207D884A609E81F5E |
| | 192.168.1.1 | root | * A731AEBFB621E354CD41BAF207D884A609E81F5E |
+-- +
2 rows in set (0.00 sec)
Mysql > use mysql
Database changed
Query OK, 0 rows affected (0.00 sec)
Grant all on *. * to admin@'%' identified by '123456' with grant option
Mysql > flush privileges
Query OK, 0 rows affected (0.00 sec)
This is the end of this article on "how to implement offline installation of mysql in linux". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it out for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.