In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Centos7 and centos6.5 environment rpm installation of mysql5.7 and mysql5.6 detailed description of centos environment installation mysql5.7
In fact, it is not recommended to install mysql5.7 syntax and configuration may be quite different from previous versions, many holes, careful to enter
1.yum installation (not recommended)
a. Install the mysql5.7 yum source
Centos6:
Wget dev.mysql.com/get/mysql-community-release-el6-5.noarch.rpm
Yum localinstall mysql-community-release-el6-5.noarch.rpm
Centos7:
Wget dev.mysql.com/get/mysql57-community-release-el7-7.noarch.rpm
Yum localinstall mysql57-community-release-el7-7.noarch.rpm
Yum installation:
Yum install mysql-community-server
2.rpm installation (recommended)
Since the download speed of Yum source is very slow abroad, it is recommended to download it directly and install it locally.
Centos6:
Mysql-community-client-5.7.15-1.el6.x86_64.rpm
Mysql-community-common-5.7.15-1.el6.x86_64.rpm
Mysql-community-libs-5.7.15-1.el6.x86_64.rpm
Mysql-community-server-5.7.15-1.el6.x86_64.rpm
Centos7:
Mysql-community-client-5.7.15-1.el7.x86_64.rpm
Mysql-community-common-5.7.15-1.el7.x86_64.rpm
Mysql-community-libs-5.7.15-1.el7.x86_64.rpm
Mysql-community-server-5.7.15-1.el7.x86_64.rpm
Yum localinstall-y mysql-community*.rpm
Error report:
Error: Package: 2:postfix-2.6.6-6.el6_7.1.x86_64 (localyum)
Requires: libmysqlclient.so.16 (libmysqlclient_16) (64bit)
Removing: mysql-libs-5.1.71-1.el6.x86_64 (@ anaconda-CentOS-201311272149.x86_64/6.5)
Libmysqlclient.so.16 (libmysqlclient_16) (64bit)
Obsoleted By: mysql-community-libs-5.7.15-1.el6.x86_64 (/ mysql-community-libs-5.7.15-1.el6.x86_64)
Not found
Updated By: mysql-libs-5.1.73-7.el6.x86_64 (localyum)
Libmysqlclient.so.16 (libmysqlclient_16) (64bit)
Error: Package: 2:postfix-2.6.6-6.el6_7.1.x86_64 (localyum)
Requires: libmysqlclient.so.16 () (64bit)
Removing: mysql-libs-5.1.71-1.el6.x86_64 (@ anaconda-CentOS-201311272149.x86_64/6.5)
Libmysqlclient.so.16 () (64bit)
Obsoleted By: mysql-community-libs-5.7.15-1.el6.x86_64 (/ mysql-community-libs-5.7.15-1.el6.x86_64)
Not found
Updated By: mysql-libs-5.1.73-7.el6.x86_64 (localyum)
Libmysqlclient.so.16 () (64bit)
You could try using-skip-broken to work around the problem
You could try running: rpm-Va-nofiles-nodigest
Solution:
Rpm-e-- nodeps mysql-libs-5.1.71-1.el6.x86_64
1) the default root password is empty, but it is not empty. Login failed using mysql-u root-p
2) the initialization of mysql_secure_installation will not work.
Edit the mysql configuration file directly
Vim / etc/my.cnf
Join
Skip-grant-tables
Note: to add to the [mysqld] position
Restart the database
# enter the mysql console
# mysql
Possible errors:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket'/ tmp/mysql.sock'
Solution: add-h227.0.0.1
[root@node2 bin] # mysql-h227.0.0.1-uroot-p
Enter password:
Welcome to the MySQL monitor. Commands end with; or\ g.
Your MySQL connection id is 3
Server version: 5.7.15 MySQL Community Server (GPL)
Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
Affiliates. Other names may be trademarks of their respective
Owners.
Type 'help;' or'\ h' for help. Type'\ c'to clear the current input statement.
Mysql > show databases
+-+
| | Database |
+-+
| | information_schema |
| | mysql |
| | performance_schema |
| | sys |
+-+
4 rows in set (0.13 sec)
> use mysql
# change password
> update user set authentication_string = password ('yourpasswd'), password_expired =' Nice, password_last_changed = now () where user = 'root'
Delete skip-grant-tables and restart it again.
When adding a user, an error is reported because of the password policy. We are just testing that the password does not need to be that complicated.
Mysql > grant all privileges on test.* to jack@'%' identified by "test"
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
Just change the password policy.
Mysql > set global validate_password_policy=0
Example configuration of the mysql5.7 development environment:
[mysqld]
Datadir=/var/lib/mysql
Socket=/var/lib/mysql/mysql.sock
Max_connections=1024
# Disabling symbolic-links is recommended to prevent assorted security risks
Symbolic-links=0
Log-error=/var/log/mysqld.log
Pid-file=/var/run/mysqld/mysqld.pid
Sql_mode = "STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION,NO_ZERO_DATE,NO_ZERO_IN_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_UNSIGNED_SUBTRACTION"
[client]
Default-character-set = utf8mb4
[mysql]
Default-character-set = utf8mb4
[mysqld]
Character-set-client-handshake = FALSE
Character-set-server = utf8mb4
Collation_server = utf8mb4_general_ci
Init_connect='SET NAMES utf8mb4'
Ucloud mysql5.7 configuration:
[client]
Default-character-set = utf8mb4
[mysql]
Default-character-set = utf8mb4
[mysqld]
Back_log = 2000
Basedir = / opt/udb/program/mysql/mysql-5.7.12
Bind-address = 127.0.0.1
Binlog-format = MIXED
Character-set-client-handshake = 0
Character_set_server = utf8mb4
Datadir = / opt/udb/instance/mysql-5.7/xxxxxxxx/data
Event_scheduler = ON
Expire_logs_days = 7
General-log-file = / opt/udb/instance/mysql-5.7/xxxxxxxx/log/mysqld.log
Init_connect = 'SET NAMES utf8mb4'
Innodb_buffer_pool_size = 377487360
Innodb_data_file_path = ibdata1:100M:autoextend
Innodb_data_home_dir = / opt/udb/instance/mysql-5.7/xxxxxxxx/data
Innodb_file_per_table = 1
Innodb_flush_log_at_trx_commit = 2
Innodb_flush_method = O_DIRECT
Innodb_io_capacity = 2000
Innodb_log_buffer_size = 8388608
Innodb_log_file_size = 512m
Innodb_log_files_in_group = 2
Innodb_log_group_home_dir = / opt/udb/instance/mysql-5.7/xxxxxxxx/data
Innodb_max_dirty_pages_pct = 50
Innodb_open_files = 1024
Innodb_read_io_threads = 8
Innodb_thread_concurrency = 20
Innodb_write_io_threads = 8
Key_buffer_size = 33554432
Local_infile = 1
Log-bin = / opt/udb/instance/mysql-5.7/xxxxxxxx/binlog/mysql-bin.log
Log-error = / opt/udb/instance/mysql-5.7/xxxxxxxx/log/mysqld.log
Log_bin_trust_function_creators = 1
Log_output = TABLE
Long_query_time = 3
Max_allowed_packet = 16777216
Max_connect_errors = 1000000
Max_connections = 2000
Myisam_sort_buffer_size = 8388608
Net_buffer_length = 8192
Performance_schema = 0
Performance_schema_max_table_instances = 200
Pid-file = / opt/udb/instance/mysql-5.7/xxxxxxxx/mysqld.pid
Port = 3306
Query_cache_size = 16777216
Read_buffer_size = 262144
Read_rnd_buffer_size = 524288
Relay-log = / opt/udb/instance/mysql-5.7/xxxxxxxx/relaylog/mysql-relay.log
Secure-file-priv = / opt/udb/instance/mysql-5.7/xxxxxxxx/tmp
Server-id = 2130706433
Skip-slave-start
Skip_name_resolve
Slave-load-tmpdir = / opt/udb/instance/mysql-5.7/xxxxxxxx/tmp
Slave-parallel-type = LOGICAL_CLOCK
Slave_parallel_workers = 8
Slow-query-log-file = / opt/udb/instance/mysql-5.7/xxxxxxxx/log/mysql-slow.log
Slow_query_log = 1
Socket = / opt/udb/instance/mysql-5.7/xxxxxxxx/mysqld.sock
Sort_buffer_size = 524288
Sql_mode = STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION,NO_ZERO_DATE,NO_ZERO_IN_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_UNSIGN
Sync_binlog = 1
Table_open_cache = 128,
Thread_cache_size = 50
Tmpdir = / opt/udb/instance/mysql-5.7/xxxxxxxx/tmp
User = mysql
[mysqld_safe]
Log-error = / opt/udb/instance/mysql-5.7/xxxxxxxx/log/mysqld.log
Pid-file = / opt/udb/instance/mysql-5.7/xxxxxxxx/mysqld.pid
Install mysql5.6 in centos6.5 environment
Operating system: centos6.5 x86x64
1. Check whether linux has mysql installed.
Rpm-qa | grep-I mysql
# if installed, uninstall the old version first
Rpm-e-nodeps mysql...
Rpm-e-- nodeps mysql-libs-5.1.73-5.el6_6.x86_64
two。 Download the required installation package at:
Http://dev.mysql.com/downloads/mysql/5.6.html#downloads
MySQL-client-5.6.34-1.el6.x86_64.rpm
MySQL-devel-5.6.34-1.el6.x86_64.rpm
MySQL-server-5.6.34-1.el6.x86_64.rpm
Install all
Yum install numactl-y
Rpm-ivh MySQL-*.rpm
3. Modify the configuration file location and make related settings
Cp / usr/share/mysql/my-default.cnf / etc/my.cnf
The default database is placed in the / var/lib/mysql directory. We need to put the database in the / data/yunva/mysqldata directory. The main reason is that / var/lib is the root directory of the system. When the database file is large, the system will not have enough disk space.
Vim / etc/my.cnf
Innodb_file_per_table = 1
Datadir = / data/yunva/mysql/mysqldata
Log-bin=/data/yunva/mysql/binlogs/mysql-bin
Modify directory permissions
Chmod 755 / data/yunva/mysql/
Mkdir-p / data/yunva/mysql/mysqldata
Mkdir / data/yunva/mysql/binlogs/
# Note that the mysqldata and mysqlbin directories must be empowered to mysql or it cannot be started.
Chown-R mysql.mysql / data/yunva/mysql
Delete anonymous user
Mysql > delete from user where user='' and host='localhost' or host='monitor01'
Add root password
Mysql > update user set password=PASSWORD ('pass')
Query OK, 3 rows affected (0.00 sec)
Rows matched: 3 Changed: 3 Warnings: 0
Mysql > flush privileges
If the previous version is installed, you need to reset the root password. You can join at the mysqld pace of my.cnf, restart mysql, and enter the database without entering the password.
Skip-grant-tables
Default location of password:
# cat / root/.mysql_secret
4. Initialize MySQL and set password
/ usr/bin/mysql_install_db
Service mysql start
Errors that may be encountered:
Obviously, the root password in the mysql.user table has been changed. An error was reported when executing the command:
Mysql > show databases
ERROR 1820 (HY000): You must SET PASSWORD before executing this statement
Mysql > use mysql
ERROR 1820 (HY000): You must SET PASSWORD before executing this statement
Solution:
Mysql > SET PASSWORD = PASSWORD ('123')
Query OK, 0 rows affected (0.00 sec)
Error report:
# rpm-ivh MySQL-server-5.6.34-1.el6.x86_64.rpm
Warning: MySQL-server-5.6.34-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Error: Failed dependencies:
Libnuma.so.1 () (64bit) is needed by MySQL-server-5.6.34-1.el6.x86_64
Libnuma.so.1 (libnuma_1.1) (64bit) is needed by MySQL-server-5.6.34-1.el6.x86_64
Libnuma.so.1 (libnuma_1.2) (64bit) is needed by MySQL-server-5.6.34-1.el6.x86_64
Solution:
[root@monitor01 software] # yum install numactl-y
Error report:
# service mysql start
Starting MySQL. ERROR! The server quit without updating PID file (/ data/yunva/mysqldata/10-10-50-133.pid).
Because the parent directory / data/yunva does not have permission for mysql
Solution: chown-R mysql.mysq / data/yunva
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.