In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article introduces the knowledge of "how to install MySQL binary package". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
I. installation instructions
This article uses binary package installation and simple configuration of the MySQL-v5.6.51 version.
Download version 5.6:
Https://downloads.mysql.com/archives/community/
Select the appropriate version of 5.6 for "Product Version" on this URL address page.
Local VM virtual machines are used to deploy tests in this article.
OS:CentOS Linux release 7.8.2003 (Core) 3.10.0-1160.15.2.el7.x86_64
Virtual machine configuration: 2-core CPU, 4G memory
2. Clean up the system environment CentOS 7 version of the system comes with MariaDB installed by default, which needs to be cleaned first.
# # query installed mariadb
Rpm-qa | grep mariadb
# # Uninstall the mariadb package. The file name is the file queried by the above command
Rpm-e-- nodeps mariadb-libs-5.5.65-1.el7.x86 _ 64III, create mysql users. Group and data directory # # create data storage directory mkdir-p / data/mysql # # create user group mysql groupadd-r mysql # # create user mysql and set not to log in to the system, specify host directory useradd-g mysql-r-s / sbin/nologin-M-d / data/mysql mysql # # modify data storage directory properties and permissions chown mysql.mysql / data/mysql chmod 0700 / data/mysql IV, install and configure MySQL1. Download the binary package cd / data/tools wget https://cdn.mysql.com//Downloads/MySQL-5.6/mysql-5.6.51-linux-glibc2.12-x86_64.tar.gz2. Extract and install to the specified directory (/ usr/local) tar xf mysql-5.6.51-linux-glibc2.12-x86_64.tar.gz-C / usr/local/ cd / usr/local # # to create a soft link to facilitate subsequent operations of ln-sv mysql-5.6.51-linux-glibc2.12-x86_64 mysql3. Create a configuration file vi / etc/my.cnf / / enter the following [client] port = 3306 socket = / usr/local/mysql/mysql.sock default-character-set = utf8mb4 [mysqld] port = 3306 socket = / usr/local/mysql/mysql.sock basedir = / usr/local/mysql datadir = / data/mysql character-set-server = utf8mb4 collation-server = utf8mb4_general_ci init_connect = 'SET NAMES utf8mb4' server-id = 1 log-slave-updates = true skip- External-locking skip-name-resolve key_buffer_size = 256m max_allowed_packet = 64m table_open_cache = 256 sort_buffer_size = 16m read_buffer_size = 8m read_rnd_buffer_size = 64m myisam_sort_buffer_size = 256m thread_cache_size = 16 query_cache_size = 128m query_cache_type = 1 log-bin = mysql-bin binlog_format = row expire_logs_days = 30 slow_query_log = on long_query_time = 2 slow_query_log _ file = / data/mysql/db-slow.log gtid-mode = on enforce-gtid-consistency = true default-storage-engine = INNODB innodb_additional_mem_pool_size = 64m innodb_buffer_pool_size = 1G innodb_data_file_path = ibdata1:10M:autoextend innodb_write_io_threads = 4 innodb_read_io_threads = 4 innodb_thread_concurrency = 8 innodb_flush_log_at_trx_commit = 1 innodb_log_buffer_size = 16m innodb_log_file_size = 512m innodb_log_files_in_group = 3 innodb_max_dirty_pages_pct = 90 innodb_lock_wait_timeout = 60 innodb_file_per_table = on max_connections = 5000 interactive_timeout = 28800 wait_timeout = 28800 sql_mode = NO_ENGINE_SUBSTITUTION STRICT_TRANS_TABLES explicit_defaults_for_timestamp = true [mysqldump] quick max_allowed_packet = 32m [mysql] no-auto-rehash default-character-set = utf8mb4 [myisamchk] key_buffer_size = 128m sort_buffer_size = 128m read_buffer = 8m write_buffer = 8m [mysqlhotcopy] interactive-timeout [mysqld_safe] log-error = / data/mysql/mysql_err.log pid-file = / data/mysql/mysqld.pid
Note: the parameters can be modified according to the actual environmental requirements, and the configuration here is for reference only.
4. Modify the program directory permissions cd / usr/local/mysql chown-R mysql.mysql. 5. Initialize database cd / usr/local/mysql scripts/mysql_install_db-- defaults-file=/etc/my.cnf-- user=mysql-- basedir=/usr/local/mysql-- datadir=/data/mysql
Note: version 5.6 uses the mysql_install_db command to initialize data and does not set a temporary password for root@localhost users. The client can log in to the database system directly through the mysql command.
6. Export the man help file. Header file and lib library cd / usr/local/mysql # # help file echo "MANPATH / usr/local/mysql/man" > > / etc/man.config # # header file ln-sv / usr/local/mysql/include / usr/include/mysql # # lib library echo'/ usr/local/mysql/lib' > / etc/ld.so.conf.d/mysql.conf # # load the dynamic library file ldconfig7. Set the MySQL environment variable echo'# MySQL' > > / etc/profile echo 'PATH=$PATH:/usr/local/mysql/bin' > > / etc/profile source / etc/profile8. Configure the MySQL service management command cd / usr/local/mysql cp support-files/mysql.server / etc/rc.d/init.d/mysqld9. Start the database / etc/init.d/mysqld start / usr/local/mysql/bin/mysql-- version & & echo-e "\ e [31m mysql install is OK\ e [0m"
10. Delete useless users and test library (optional) echo-e "delete from mysql.user where user='';" | mysql-uroot-p / / prompt for password, enter directly to confirm echo-e "delete from mysql.user where host='::1';" | mysql-uroot-p echo-e "drop database test;" | mysql-uroot-p5, set root account password 1. Local login password mysql-uroot-p / / because the password is not set when initializing the data, you can press the confirm key twice to enter the database mysql > use mysql; mysql > update user set password = PASSWORD ('123456') where user = 'root'; mysql > FLUSH PRIVILEGES;2. Remote login password # mysql-uroot-p / / enter the password set in the above steps to log in to the database mysql > GRANT ALL PRIVILEGES ON *. * TO 'root'@'%' IDENTIFIED BY' 123456' WITH GRANT OPTION; mysql > FLUSH PRIVILEGES; VI. Service management
Start: / etc/init.d/mysqld start
Close: / etc/init.d/mysqld stop
Restart: / etc/init.d/mysqld restart
View status: / etc/init.d/mysqld status
Configure boot: echo "/ etc/init.d/mysqld start" > > / etc/rc.local
This is the end of "how to install MySQL binary package". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
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.