项目上正式是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
送给本身一句话