Get the App
SLTechnology News&Howtos  ›  Servers  › 

Centos7 installation of mysql5.6 and partial optimization

Shulou Source: shulou.com Published: 2022-06-02 09:56:03 11月14日 Update

Change the hostname to mysql first and then change it to the desired hostname after migration, otherwise there will be errors mysql.pid hostnamectl set-hostname mysql [root@mysql software] # rpm-ivh MySQL-server-5.6.29-1.rhel5.x86_64.rpm warning: MySQL-server-5.6.29-1.rhel5.x86_64.rpm: Header V3 DSA/SHA1 Signature Key ID 5072e1f5: NOKEYerror: Failed dependencies: libaio.so.1 () (64bit) is needed by MySQL-server-5.6.29-1.rhel5.x86_64 libaio.so.1 (LIBAIO_0.1) (64bit) is needed by MySQL-server-5.6.29-1.rhel5.x86_64 libaio.so.1 (LIBAIO_0.4) (64bit) is needed by MySQL-server-5.6.29-1.rhel5.x86_64 Solution: so do [root@mysql software] # rpm-ivh MySQL-server-5.6.29-1.rhel5.x86_64.rpm warning: MySQL-server-5.6.29-1.rhel5.x86_64.rpm: Header V3 DSA/SHA1 Signature in advance Key ID 5072e1f5: NOKEYerror: Failed dependencies: libaio.so.1 () (64bit) is needed by MySQL-server-5.6.29-1.rhel5.x86_64 libaio.so.1 (LIBAIO_0.1) (64bit) is needed by MySQL-server-5.6.29-1.rhel5.x86_64 libaio.so.1 (LIBAIO_0.4) (64bit) is needed by MySQL-server-5.6.29-1.rhel5.x86_64 Root@mysql software] # rpm- ivh http://mirror.centos.org/centos/6/os/x86_64/Packages/libaio-0.3.107-10.el6.x86_64.rpmRetrieving http://mirror.centos.org/centos/6/os/x86_64/Packages/libaio-0.3.107-10.el6.x86_64.rpmwarning: / var/tmp/rpm-tmp.SWTMoJ: Header V3 RSA/SHA256 Signature Key ID c105b9de: NOKEYPreparing... # # [100%] Updating / installing... 1:libaio-0.3.107-10.el6 # # [root@localhost] # rpm-qa mariadb*mariadb-libs-5.5.44-2.el7.centos.x86_64 [root@localhost ~] # yum remove mariadb-libs-5.5.44-2.el7.centos.x86_64 [root@ Localhost ~] # yum install-y perl perl-devel perl-Module-Install.noarch [root@localhost ~] # rpm-ivh MySQL-devel-5.6.29-1.rhel5.x86_64.rpmwarning: MySQL-devel-5.6.29-1.rhel5.x86_64.rpm: Header V3 DSA/SHA1 Signature Key ID 5072e1f5: NOKEYPreparing... # # package MySQL-devel-5.6.29-1.rhel5.x86_64 is already installed [root@localhost ~] # rpm-ivh MySQL-client-5.6.29-1.rhel5.x86_64.rpm warning: MySQL-client-5.6.29-1.rhel5.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEYPreparing... # # package MySQL-client-5.6.29-1.rhel5.x86_64 is already installed [root@localhost ~] # rpm-ivh MySQL-server-5.6.29-1.rhel5.x86_64.rpm warning: MySQL-server-5.6.29-1.rhel5.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEYPreparing... # # [100%] package MySQL-server-5.6.29-1.rhel5.x86_64 is already installed [root@localhost] # You will find that password in'/ root/.mysql_secret'. [root@linux-node2 ~] # service mysql startStarting MySQL. SUCCESS! [root@linux-node2 ~] # [root@linux-node2 ~] # / usr/bin/mysql_secure_installation # initialization password set your own password

You need to copy the mysql of the default-- datadir to / data and give mysql permission.

[root@linux-node2 ~] # ps-ef | grep mysql

Root 12365 10 23:28 pts/1 00:00:00 / bin/sh / usr/bin/mysqld_safe-- datadir=/data/mysql-- pid-file=/var/lib/mysql/mysql.pid

Mysql 13171 12365 0 23:28 pts/1 00:00:00 / usr/sbin/mysqld-basedir=/usr-datadir=/data/mysql-plugin-dir=/usr/lib64/mysql/plugin-user=mysql-log-error=/data/mysql/mysql-error.log-open-files-limit=65535-pid-file=/var/lib/mysql/mysql.pid-socket=/data/socket/mysql.sock-port=3306

Root 13208 2804 0 23:33 pts/1 00:00:00 grep-color=auto mysql

[root@linux-node2 ~] #

Take a look at my.cnf

[root@linux-node2 ~] # cat / etc/ my.cnf [client] port = 3306 socket = / data/socket/mysql.sock default-character-set = UTF8 [mysqld] port = 3306character-set-server=utf8socket = / data/socket/mysql.sock#basedir = / usr/local/mysqldatadir = / data/mysqlpid-file = / var/lib/mysql/mysql.piduser = mysqlbind-address = 0.0.0.0server-id = 1skip-name-resolve#skip-networkingback_log = 600max_connections = 1000max_connect _ errors = 6000open_files_limit = 65535table_open_cache = 128max_allowed_packet = 4Mbinlog_cache_size = 1Mmax_heap_table_size = 8Mtmp_table_size = 16Mread_buffer_size = 2Mread_rnd_buffer_size = 8Msort_buffer_size = 8Mjoin_buffer_size = 8Mkey_buffer_size = 4Mthread_cache_size = 8query_cache_size = 8Mquery_cache_limit = 2Mft_min_word_len = 4log_bin = mysql-binbinlog_format = mixedexpire_logs_days = 30log_error = / Data/mysql/mysql-error.logslow_query_log = 1long_query_time = 1slow_query_log_file = / data/mysql/mysql-slow.logperformance_schema = 0explicit_defaults_for_timestamp#lower_case_table_names = 1skip-external-lockingdefault_storage_engine = InnoDB#default-storage-engine = MyISAMinnodb_file_per_table = 1innodb_open_files = 500innodb_buffer_pool_size = 64Minnodb_write_io_threads = 4innodb_read_io_threads = 4innodb_thread_concurrency = 0innodb _ purge_threads = 1innodb_flush_log_at_trx_commit = 2innodb_log_buffer_size = 2Minnodb_log_file_size = 32Minnodb_log_files_in_group = 3innodb_max_dirty_pages_pct = 90innodb_lock_wait_timeout = 120bulk_insert_buffer_size = 8Mmyisam_sort_buffer_size = 8Mmyisam_max_sort_file_size = 10Gmyisam_repair_threads = 1interactive_timeout = 28800wait_timeout = 28800innodb_file_per_table = ONsql_mode=NO_ENGINE_SUBSTITUTION STRICT_TRANS_TABLES [mysqldump] quickmax_allowed_packet = 16m [myisamchk] key_buffer_size = 8Msort_buffer_size = 8Mread_buffer = 4Mwrite_buffer = 4m [root@linux-node2 ~] #

To modify the configuration of socket, you can stop at startup or mysql does not know the location of socket.

Backup database

Mysqldump-uroot-p123456-B mysql-F-R-master-data=2-- events-- single-transaction | gzip > / opt/mysql.20170715.gz

Mysqldump-uroot-p123456-B mysql-F-R-master-data=2-- events-- single-transaction > / opt/mysql.sql

Gzip format decompression

Gzip-d file name

Tags: Host password location method backup copy data database file name permissions format configuration part Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MariaDB Xiaomi Docker Microsoft NVidia