真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網(wǎng)站制作重慶分公司

centos7和centos6.5環(huán)境rpm方式安裝mysql5.7和mysql5.6詳解

centos7和centos6.5環(huán)境rpm方式安裝MySQL5.7和mysql5.6詳解

centos環(huán)境安裝mysql5.7

其實不建議安裝mysql5.7 語法和配置可能和以前的版本區(qū)別較大,多坑,慎入

十多年的土默特左旗網(wǎng)站建設(shè)經(jīng)驗,針對設(shè)計、前端、開發(fā)、售后、文案、推廣等六對一服務(wù),響應(yīng)快,48小時及時工作處理。成都全網(wǎng)營銷的優(yōu)勢是能夠根據(jù)用戶設(shè)備顯示端的尺寸不同,自動調(diào)整土默特左旗建站的顯示方式,使網(wǎng)站能夠適用不同顯示終端,在瀏覽器中調(diào)整網(wǎng)站的寬度,無論在任何一種瀏覽器上瀏覽網(wǎng)站,都能展現(xiàn)優(yōu)雅布局與設(shè)計,從而大程度地提升瀏覽體驗。創(chuàng)新互聯(lián)從事“土默特左旗網(wǎng)站設(shè)計”,“土默特左旗網(wǎng)站推廣”以來,每個客戶項目都認(rèn)真落實執(zhí)行。

1.yum方式安裝(不推薦)

a.安裝mysql5.7 yum源

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方式安裝:
yum install mysql-community-server

2.rpm方式安裝(推薦)
因yum源是在國外下載速度非常慢,建議直接下載后通過本地安裝

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: 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

 解決辦法:
rpm -e --nodeps mysql-libs-5.1.71-1.el6.x86_64


1)默認(rèn) root 密碼為空,其實不為空,使用 mysql -u root -p 進(jìn)行登錄失敗
2)mysql_secure_installation這個初始化也不行

直接編輯mysql配置文件
vim /etc/my.cnf
加入
skip-grant-tables
注意:要加在[mysqld]的位置

重啟數(shù)據(jù)庫

#進(jìn)入 mysql控制臺

# mysql

可能的報錯:

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (111)

解決辦法:加上-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;

# 修改密碼
>update user set authentication_string = password('yourpasswd'), password_expired = 'N', password_last_changed = now() where user = 'root';

刪掉skip-grant-tables,再次重啟即可

添加用戶時,報錯,是因為密碼策略的問題,我們只是測試,密碼不需要那么復(fù)雜

mysql> grant all privileges on test.* to jack@'%' identified by "test";

ERROR 1819 (HY000): Your password does not satisfy the current policy requirements

修改密碼策略即可
mysql> set global validate_password_policy=0;

mysql5.7開發(fā)環(huán)境的配置示例:

  1. [mysqld]  

  2.   

  3. datadir=/var/lib/mysql  

  4. socket=/var/lib/mysql/mysql.sock  

  5. max_connections=1024  

  6.   

  7. # Disabling symbolic-links is recommended to prevent assorted security risks  

  8. symbolic-links=0  

  9.   

  10. log-error=/var/log/mysqld.log  

  11. pid-file=/var/run/mysqld/mysqld.pid  

  12. 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"  

  13. [client]  

  14. default-character-set = utf8mb4  

  15.   

  16. [mysql]  

  17. default-character-set = utf8mb4  

  18.   

  19. [mysqld]  

  20. character-set-client-handshake = FALSE  

  21. character-set-server = utf8mb4  

  22. collation_server = utf8mb4_general_ci  

  23. init_connect='SET NAMES utf8mb4'  

ucloud mysql5.7配置:

  

  1. [client]  

  2. default-character-set = utf8mb4  

  3. [mysql]  

  4. default-character-set = utf8mb4  

  5. [mysqld]  

  6. back_log = 2000  

  7. basedir = /opt/udb/program/mysql/mysql-5.7.12  

  8. bind-address = 127.0.0.1  

  9. binlog-format = MIXED  

  10. character-set-client-handshake = 0  

  11. character_set_server = utf8mb4  

  12. datadir = /opt/udb/instance/mysql-5.7/xxxxxxxx/data  

  13. event_scheduler = ON  

  14. expire_logs_days = 7  

  15. general-log-file = /opt/udb/instance/mysql-5.7/xxxxxxxx/log/mysqld.log  

  16. init_connect = 'SET NAMES utf8mb4'  

  17. innodb_buffer_pool_size = 377487360  

  18. innodb_data_file_path = ibdata1:100M:autoextend  

  19. innodb_data_home_dir = /opt/udb/instance/mysql-5.7/xxxxxxxx/data  

  20. innodb_file_per_table = 1  

  21. innodb_flush_log_at_trx_commit = 2  

  22. innodb_flush_method = O_DIRECT  

  23. innodb_io_capacity = 2000  

  24. innodb_log_buffer_size = 8388608  

  25. innodb_log_file_size = 512M  

  26. innodb_log_files_in_group = 2  

  27. innodb_log_group_home_dir = /opt/udb/instance/mysql-5.7/xxxxxxxx/data  

  28. innodb_max_dirty_pages_pct = 50  

  29. innodb_open_files = 1024  

  30. innodb_read_io_threads = 8  

  31. innodb_thread_concurrency = 20  

  32. innodb_write_io_threads = 8  

  33. key_buffer_size = 33554432  

  34. local_infile = 1  

  35. log-bin = /opt/udb/instance/mysql-5.7/xxxxxxxx/binlog/mysql-bin.log  

  36. log-error = /opt/udb/instance/mysql-5.7/xxxxxxxx/log/mysqld.log  

  37. log_bin_trust_function_creators = 1  

  38. log_output = TABLE  

  39. long_query_time = 3  

  40. max_allowed_packet = 16777216  

  41. max_connect_errors = 1000000  

  42. max_connections = 2000  

  43. myisam_sort_buffer_size = 8388608  

  44. net_buffer_length = 8192  

  45. performance_schema = 0  

  46. performance_schema_max_table_instances = 200  

  47. pid-file = /opt/udb/instance/mysql-5.7/xxxxxxxx/mysqld.pid  

  48. port = 3306  

  49. query_cache_size = 16777216  

  50. read_buffer_size = 262144  

  51. read_rnd_buffer_size = 524288  

  52. relay-log = /opt/udb/instance/mysql-5.7/xxxxxxxx/relaylog/mysql-relay.log  

  53. secure-file-priv = /opt/udb/instance/mysql-5.7/xxxxxxxx/tmp  

  54. server-id = 2130706433  

  55. skip-slave-start  

  56. skip_name_resolve  

  57. slave-load-tmpdir = /opt/udb/instance/mysql-5.7/xxxxxxxx/tmp  

  58. slave-parallel-type = LOGICAL_CLOCK  

  59. slave_parallel_workers = 8  

  60. slow-query-log-file = /opt/udb/instance/mysql-5.7/xxxxxxxx/log/mysql-slow.log  

  61. slow_query_log = 1  

  62. socket = /opt/udb/instance/mysql-5.7/xxxxxxxx/mysqld.sock  

  63. sort_buffer_size = 524288  

  64. 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  

  65. sync_binlog = 1  

  66. table_open_cache = 128  

  67. thread_cache_size = 50  

  68. tmpdir = /opt/udb/instance/mysql-5.7/xxxxxxxx/tmp  

  69. user = mysql  

  70. [mysqld_safe]  

  71. log-error = /opt/udb/instance/mysql-5.7/xxxxxxxx/log/mysqld.log  

  72. pid-file = /opt/udb/instance/mysql-5.7/xxxxxxxx/mysqld.pid  

centos6.5環(huán)境安裝mysql5.6


操作系統(tǒng):centos6.5 x86_64

1.檢查下linux是不是已經(jīng)安裝了mysql
rpm -qa | grep -i mysql


#如果安裝了先卸載舊的版本    
rpm -e --nodeps mysql...

rpm -e --nodeps mysql-libs-5.1.73-5.el6_6.x86_64


2.下載需要的安裝包,下載地址:
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

全部安裝

yum install numactl -y
rpm -ivh MySQL-*.rpm


3.修改配置文件位置并做相關(guān)設(shè)置

cp /usr/share/mysql/my-default.cnf /etc/my.cnf

默認(rèn)的數(shù)據(jù)庫放在/var/lib/mysql目錄下,我們需要將數(shù)據(jù)庫放在/data/yunva/mysqldata 目錄下,主要是/var/lib是系統(tǒng)根目錄,數(shù)據(jù)庫文件較大的時候系統(tǒng)磁盤空間會不夠

vim /etc/my.cnf

innodb_file_per_table = 1
datadir = /data/yunva/mysql/mysqldata
log-bin=/data/yunva/mysql/binlogs/mysql-bin

修改目錄權(quán)限

chmod 755 /data/yunva/mysql/

mkdir -p /data/yunva/mysql/mysqldata

mkdir /data/yunva/mysql/binlogs/

# 注意必須給mysqldata和mysqlbin目錄賦權(quán)給mysql否則無法啟動
chown -R mysql.mysql /data/yunva/mysql


刪除匿名用戶
mysql> delete from user where user='' and host='localhost' or host='monitor01';

添加root密碼
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;

如果之前的版本有安裝,需要重置root密碼,可以在my.cnf的mysqld步伐加入,重啟mysql,不輸入密碼即可進(jìn)數(shù)據(jù)庫
skip-grant-tables

密碼默認(rèn)位置:

# cat /root/.mysql_secret

4.初始化MySQL及設(shè)置密碼

/usr/bin/mysql_install_db
service mysql start

可能碰到的錯誤:
明明已經(jīng)修改了mysql.user表中的root密碼,執(zhí)行命令報錯:

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

解決辦法:
mysql> SET PASSWORD = PASSWORD('123');
Query OK, 0 rows affected (0.00 sec)

  報錯:

# 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

解決辦法:
[root@monitor01 software]# yum install numactl -y

報錯:

# service mysql start
Starting MySQL. ERROR! The server quit without updating PID file (/data/yunva/mysqldata/10-10-50-133.pid).

是因為上級目錄/data/yunva對mysql沒有權(quán)限

解決辦法:chown -R mysql.mysq /data/yunva


網(wǎng)站名稱:centos7和centos6.5環(huán)境rpm方式安裝mysql5.7和mysql5.6詳解
文章網(wǎng)址:http://weahome.cn/article/pshhej.html

其他資訊

在線咨詢

微信咨詢

電話咨詢

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部