【秒杀】项目问题

【MYSQL】3719 ‘utf8’ is currently an alias for the character set UTF8MB3

warning(s): 3719 '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.
  1. 首先查看下mysql字符集
SHOW VARIABLES WHERE Variable_name LIKE 'character\_set\_%' OR Variable_name LIKE 'collation%';

在这里插入图片描述
MySQL在5.5.3之后增加了这个utf8mb4的编码,mb4就是most bytes 4的意思,专门用来兼容四字节的unicode。好在utf8mb4是utf8的超集,除了将编码改为utf8mb4外不需要做其他转换。当然,一般情况下使用utf8也就够了。

那上面说了既然utf8能够存下大部分中文汉字,那为什么还要使用utf8mb4呢? 原来utf-8编码可能2个字节、3个字节、4个字节的字符,但是MySQL的utf8编码只支持3字节的数据,而移动端的表情数据是4个字节的字符。也就是说直接往采用utf-8编码的数据库中插入表情数据和很多不常用的汉字,以及任何新增的 Unicode 字符等等数据库都将会报错。
为了获取更好的兼容性,应该总是使用 utf8mb4 而非 utf8,事实上,最新版的phpmyadmin默认字符集就是utf8mb4。诚然,对于 CHAR 类型数据,使用utf8mb4 存储会多消耗一些空间。根据 Mysql 官方建议,使用 VARCHAR 替代 CHAR。

drop table if exists t_user ;
create table t_user(
id int not null,
name varchar(20),
primary key(id)
)engine=InnoDB default charset=utf8mb4;

intellij idea 2019 右键包新建文件是没有java Class选项

https://www.cnblogs.com/zhainan-blog/p/11375191.html
右键文件夹:Mark Directory as sources root

springboot整合mybatis mapper注入时显示could not autowire的解决

解决方法,在mapper加一个注解。
@Component(value = “userMapper”) 或者@Repository

SpringBoot整合Mybatis出现的错误:At least one base package must be specified

错误原因:没有在主函数的类中对Mapper层进行扫描
解决:在主函数上加上对mapper层的扫描MapperScan注解

@SpringBootApplication
@MapperScan("com.ll.seckill.dao")
public class MainApplication {
    public static void main(String[] args) {
        SpringApplication.run(MainApplication.class, args);
    }
}

mysql 无法连接 Unable to load authentication plugin ‘caching_sha2_password’.

这个是因为,mysql8之前的版本使用的密码加密规则是mysql_native_password,但是在mysql8则是caching_sha2_password,所以需要修改密码加密规则。
1、进去mysql 8.0 command line client
2、输入 use mysql
3、select user,host,plugin,authentication_string from user;可以看到如下的界面,即用户的密码加密规则
在这里插入图片描述
4、alter user ‘root’ @‘localhost’ identified with mysql_native_password by ‘admin’;
在这里插入图片描述

redis异常解决:jedis.exceptions.JedisDataException: ERR Client sent AUTH, but no password is set

https://blog.csdn.net/m0_37190495/article/details/80360804
问题原因看起来很清楚,就是这句: ERR Client sent AUTH, but no password is set

它的意思就是redis服务器没有设置密码,但客户端向其发送了AUTH请求,于是把程序中所有jedis发送授权的地方都去掉,可是发现异常还是存在!!简直无语了

最后想起在tomcat中还有同步session到redis的配置,这里还设置了password,而且即使是空“”也不行。把整个password干掉,重启,ok啦!

<Valve className="com.radiadesign.catalina.session.RedisSessionHandlerValve" />
      <Manager className="com.radiadesign.catalina.session.RedisSessionManager"
               host="172.11.22.33" password="" port="6379" database="5" maxInactiveInterval="60" />
  1. 使用记事本打开文件:redis-windows.conf.
  2. 设置redis的密码:
    全局搜索requirepass找到后打开注释,并且在后面添加自己的密码,博主密码设置的是123456,
    设置监听的IP:
    全局搜索:bind可以看到上面的注释,可以在此处添加监听IP,可以配置多个.
  3. 设置好后保存退出,cmd进入Windows命令窗口:切换到解压文件目录下,运行命令:
    redis-server.exe redis-windows.conf;使用redis-windows.conf的配置,启动redis-server.exe,启动
  4. 另开一个命令窗口,运行redis客户端,键入命令:redis-cli.exe -h 127.0.0.1 -a 123456
    命令的格式是;redis-cli.exe -h IP -a password

不指定配置文件启动时采用默认配置,无密码
redis通过属性requirepass 设置访问密码,但没有设置该属性时,客户端向服务端发送AUTH请求,服务端就好返回异常:ERR Client sent AUTH, but no password is set

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值