您正在查看: Other-经验分享 分类下的文章

解决Unexpected end of JSON input while parsing near 问题

终端执行命令npm cache clean --force
完成后再执行命令npm install

Install MySQL 8 on Windows 10 64bit

下载

下载地址:https://dev.mysql.com/downloads/mysql/8.0.html

1.解压

mysql-8.0.19-winx64.zip

演示文件目录

C:\Program Files\mysql-8.0.19-winx64

2.创建两个文件夹

C:\Program Files\mysql-8.0.19-winx64\data
C:\Program Files\mysql-8.0.19-winx64\logs

3.设置环境变量

4.新建my.ini配置

[mysqld]
#安装目录
basedir = C:\Program Files\mysql-8.0.19-winx64
#数据文件目录
datadir = C:\Program Files\mysql-8.0.19-winx64\data
port = 3306
server_id = 1
general_log = ON
general_log_file = C:\Program Files\mysql-8.0.19-winx64\logs\mysql.log
log_error = C:\Program Files\mysql-8.0.19-winx64\logs\error.log
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES 
character-set-server = utf8mb4
performance_schema_max_table_instances = 600
table_definition_cache = 400
table_open_cache = 256
#sql_mode=ONLY_FULL_GROUP_BY,NO_AUTO_VALUE_ON_ZERO,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION,PIPES_AS_CONCAT,ANSI_QUOTES
[mysql]
default-character-set = utf8mb4

[client]
default-character-set = utf8mb4

5.管理员权限开启CMD窗口

5.1 初始化
mysqld --initialize --console #不用特别指定default file默认会使用my.ini

控制台输入如下表示成功

C:\Program Files\mysql-8.0.19-winx64>mysqld --initialize --console
2020-04-21T10:11:25.148253Z 0 [Warning] [MY-010915] [Server] 'NO_ZERO_DATE', 'NO_ZERO_IN_DATE' and 'ERROR_FOR_DIVISION_BY_ZERO' sql modes should be used with strict mode. They will be merged with strict mode in a future release.
2020-04-21T10:11:25.148318Z 0 [System] [MY-013169] [Server] C:\Program Files\mysql-8.0.19-winx64\bin\mysqld.exe (mysqld 8.0.19) initializing of server in progress as process 8684
2020-04-21T10:11:47.571686Z 5 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: Fv?_a7%jn_R(

Warning暂时没做理会,没发现使用异常
记下上面日志最后面的root的初始化密码Fv?_a7%jn_R(,下面要用到

5.2 安装服务
mysqld --install [服务名] #不写服务名默认为mysql
5.3 启动数据库
C:\Program Files\mysql-8.0.19-winx64>net start mysql
MySQL 服务正在启动 ..
MySQL 服务已经启动成功。
5.4 使用临时密码登陆数据库
C:\Program Files\mysql-8.0.19-winx64>mysql -u root -p
Enter password: ************
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 10
Server version: 8.0.19

Copyright (c) 2000, 2020, 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.
5.5 修改root初始化密码
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '要改的新密码';

ERROR 2003 (HY000): Can't connect to MySQL server on 'localhost' (10061)

执行命令查看输出log

mysqld --console
D:\Program Files\mysql-8.0.19-winx64>mysqld --console
2020-04-03T03:29:17.907577Z 0 [System] [MY-010116] [Server] D:\Program Files\mysql-8.0.19-winx64\bin\mysqld.exe (mysqld 8.0.19) starting as process 4772
2020-04-03T03:29:17.909125Z 0 [Warning] [MY-013242] [Server] --character-set-server: 'utf8' is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous.
2020-04-03T03:29:19.799340Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2020-04-03T03:29:19.819720Z 0 [System] [MY-010931] [Server] D:\Program Files\mysql-8.0.19-winx64\bin\mysqld.exe: ready for connections. Version: '8.0.19'  socket: ''  port: 0  MySQL Community Server - GPL.
2020-04-03T03:29:19.822756Z 0 [ERROR] [MY-010131] [Server] TCP/IP, --shared-memory, or --named-pipe should be configured on NT OS
2020-04-03T03:29:19.825137Z 0 [ERROR] [MY-010119] [Server] Aborting
2020-04-03T03:29:19.878167Z 0 [Warning] [MY-011311] [Server] Plugin mysqlx reported: 'All I/O interfaces are disabled, X Protocol won't be accessible'
2020-04-03T03:29:20.525948Z 0 [System] [MY-010910] [Server] D:\Program Files\mysql-8.0.19-winx64\bin\mysqld.exe: Shutdown complete (mysqld 8.0.19)  MySQL Community Server - GPL.

关键错误

TCP/IP, --shared-memory, or --named-pipe should be configured on NT OS

解决方案

修改my.ini,添加shared-memory

2059 – 身份验证插件’caching_sha2_password’-navicat连接异常

这个问题是由于我的MySQL的的的更新至8版本以上了,在安装的时候我并没有指定用户登入密码加密方式,所以默认被设置为caching_sha2_password
解决方法:

mysql> show variables like 'default_authentication_plugin';
Variable_name Value
default_authentication_plugin caching_sha2_password

查看本地mysql用户的信息

mysql> select host,user,plugin from mysql.user;
host user plugin
localhost mysql.infoschema caching_sha2_password
localhost mysql.session caching_sha2_password
localhost mysql.sys caching_sha2_password
localhost root caching_sha2_password

注意 caching_sha2_password, 只修改root的密码加密方式就可以了

mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '123456';
mysql> select host,user,plugin from mysql.user;
host user plugin
localhost mysql.infoschema caching_sha2_password
localhost mysql.session caching_sha2_password
localhost mysql.sys caching_sha2_password
localhost root mysql_native_password

goland: x86_64-pc-cygwin/bin/ld: cannot find -lmingwex cannot find -lmingw32

使用tdm-gcc
https://jmeubank.github.io/tdm-gcc/download/
然后再系统环境变量path里把tdragon的位置上移到cygwin上面,
让系统调用gcc时先识别tdragon的gcc,或者直接把cygwin的环境路径直接删除了,
或者直接从goland里的settings->Go->GoPath里添加tdragon的路径,如下图