標籤:adb eset arc 依次 rac str please load ons
環境
CentOS 7 64位
MySQL 5.7 64位
1.卸載系統內建的 mariadb
[[email protected] /]# rpm -qa|grep mariadbmariadb-libs-5.5.56-2.el7.x86_64[[email protected] /]# rpm -e mariadb-libs-5.5.56-2.el7.x86_64 --nodeps
2.下載RPM包
到MySQL官網下載rpm集合包到本地再上傳至伺服器或通過下面的方法直接在伺服器下載
wget http://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.13-1.el7.x86_64.rpm-bundle.tar
3.解壓tar包
[[email protected] softwares]# lsmysql-5.7.18-1.el7.x86_64.rpm-bundle.tar[[email protected] softwares]# tar -xvf mysql-5.7.18-1.el7.x86_64.rpm-bundle.tar mysql-community-server-5.7.18-1.el7.x86_64.rpmmysql-community-embedded-devel-5.7.18-1.el7.x86_64.rpmmysql-community-devel-5.7.18-1.el7.x86_64.rpmmysql-community-client-5.7.18-1.el7.x86_64.rpmmysql-community-common-5.7.18-1.el7.x86_64.rpmmysql-community-embedded-5.7.18-1.el7.x86_64.rpmmysql-community-embedded-compat-5.7.18-1.el7.x86_64.rpmmysql-community-libs-5.7.18-1.el7.x86_64.rpmmysql-community-server-minimal-5.7.18-1.el7.x86_64.rpmmysql-community-test-5.7.18-1.el7.x86_64.rpmmysql-community-minimal-debuginfo-5.7.18-1.el7.x86_64.rpmmysql-community-libs-compat-5.7.18-1.el7.x86_64.rpm
4.安裝
依次執行(幾個包有依賴關係,所以執行有先後)下面命令安裝
rpm -ivh mysql-community-common-5.7.18-1.el7.x86_64.rpmrpm -ivh mysql-community-libs-5.7.18-1.el7.x86_64.rpmrpm -ivh mysql-community-client-5.7.18-1.el7.x86_64.rpmrpm -ivh mysql-community-server-5.7.18-1.el7.x86_64.rpm
5.資料庫初始化
mysqld --initialize --user=mysql
--initialize 選項預設以“安全”模式來初始化,則會為 root 使用者產生一個密碼並將該密碼標記為到期(密碼在/var/log/mysqld.log中),登陸後你需要設定一個新的密碼,而使用 --initialize-insecure 命令則不使用安全模式,則不會為 root 使用者產生一個密碼。
[[email protected] softwares]# more /var/log/mysqld.log2018-02-24T08:27:17.789803Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).2018-02-24T08:27:18.923811Z 0 [Warning] InnoDB: New log files created, LSN=457902018-02-24T08:27:18.981104Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.2018-02-24T08:27:19.116973Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 87296646-193c-11e8-adaf-000c29ee8fae.2018-02-24T08:27:19.332937Z 0 [Warning] Gtid table is not ready to be used. Table ‘mysql.gtid_executed‘ cannot be opened.2018-02-24T08:27:19.333647Z 1 [Note] A temporary password is generated for [email protected]: m)6_=8yl6(pA
最後一行給出了MySQL登入密碼。
啟動MySQL服務,登入MySQL
[[email protected] softwares]# systemctl start mysqld[[email protected] softwares]# mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g.Your MySQL connection id is 3Server version: 5.7.18Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input statement.mysql>
6.重設root使用者密碼
提示密碼到期,需要重設
mysql> show databases;ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
重設密碼
ALTER USER ‘root‘@‘localhost‘ IDENTIFIED BY ‘new_password‘;或mysql> set password for ‘root‘@‘localhost‘=password(‘new_password‘);
7.遠程授權登入
root 使用者名稱
% 所有人都可以訪問
password 密碼
# 給特定IP授權GRANT ALL PRIVILEGES ON *.* TO ‘root‘@‘192.168.1.100‘ IDENTIFIED BY ‘password‘ WITH GRANT OPTION;# 給任意IP授權GRANT ALL PRIVILEGES ON *.* TO ‘root‘@‘%‘ IDENTIFIED BY ‘password‘ WITH GRANT OPTION;
重新整理許可權
flush privileges;
8.配置utf8編碼
修改/etc/my.cnf,在後面加上下面內容
[mysqld]character_set_server=utf8init_connect=‘SET NAMES utf8‘
重啟MySQL
systemctl restart mysqld
顯示編碼
show variables like ‘%character%‘;
參考連結:
1.https://my.oschina.net/Laily/blog/713022
2.http://www.cnblogs.com/maobuji/p/8336702.html
CentOS RPM 安裝 MySQL5.7