項目上正式是MySQL5.7.21-log版本,可是本地測試是使用的MySQL5.7.22,蛋疼的客戶非得統一版本,本着學習的精神,本身折騰了一天、html
因而把測試數據庫也撞上了MySQL5.7.21mysql
第一步 下載:mysql-5.7.21-linux-glibc2.12-x86_64linux
第二步 上傳、解壓mysql-5.7.21-linux-glibc2.12-x86_64 ,使用tar -xvf mysql-5.7.21-linux-glibc2.12-x86_64,將解壓的文件重命名並移到/usr/localsql
第三步 在mysql-5.7下新增文件夾data,var,etc備用數據庫
第四步 建立數據庫配置文件,若是在/etc(不是本身建立的)下有my.cnf則修改,若是沒有則touch新建bash
# For advice on how to change settings please see # http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html # *** DO NOT EDIT THIS FILE. It‘s a template which will be copied to the # *** default location during install, and will be replaced if you # *** upgrade to a newer version of MySQL. [mysqld] # Remove leading # and set to the amount of RAM for the most important data # cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%. # innodb_buffer_pool_size = 128M # Remove leading # to turn on a very important data integrity option: logging # changes to the binary log between backups. # log_bin # These are commonly set, remove the # and set as required.
# /usr/local/mysql5721/mysql-5.7.21是解壓以後的文件夾 basedir=/usr/local/mysql5721/mysql-5.7.21 datadir =/usr/local/mysql5721/mysql-5.7.21/data port = 5723 log-error = /usr/local/mysql5721/mysql-5.7.21/data/error.log pid-file = /usr/local/mysql5721/mysql-5.7.21/data/mysql.pid socket = /usr/local/mysql5721/mysql-5.7.21/mysql.sock # Remove leading # to set options mainly useful for reporting servers. # The server defaults are faster for transactions and fast SELECTs. # Adjust sizes as needed, experiment to find the optimal values. # join_buffer_size = 128M # sort_buffer_size = 2M # read_rnd_buffer_size = 2M #sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES [client] socket = /usr/local/mysql5721/mysql-5.7.21/mysql.sock
第五步改變文件夾權限,使得mysql能夠訪問socket
#groupadd mysql2 #useradd mysql2-g mysql2 #chown -R mysql2:mysql2 mysql-5.7.21/ #chmod -R 777 mysql-5.7.21/
第六步學習
指定配置文件初始化測試
./bin/mysqld --defaults-file=/usr/local/mysql5721/mysql-5.7.21/etc/my.cnf --initialize --user=mysql2 --socket = /tmp/mysql5721.socket --port=5721
查詢默認密碼ui
cat /usr/local/mysql5721/mysql5.7.21/data/error.log
generated for root@localhost後面就是默認生成的密碼
第七步
啓動mysql,執行 ./support-files/mysql.server start
第八步
修改密碼配置權限,打開Navicat鏈接
問題以及參考文章
MYSQL多數據庫安裝
https://blog.csdn.net/u010898329/article/details/83064373
MYSQL安裝後一些問題
解決Navicat 報錯:1130-host is not allowed MySQL不容許從遠程訪問的方法
https://www.cnblogs.com/mengyuxin/p/5485143.html
You must reset your password using ALTER USER statement before executing this statement.
https://www.cnblogs.com/debmzhang/p/5013540.html
MySQL添加用戶、刪除用戶與受權
https://www.cnblogs.com/wanghetao/p/3806888.html
送給本身一句話