Thinkphp更新到了6.0.9,我升级后发现原来运行正常的代码会报类似这样的错误
think\db\baseQuery::jsonResult(): Argument #1 ($result) must be of type array.....
发现是因为升级过程中,
topthink/think-orm 从2.0.44升级到了2.0.45,将期版本降级至2.0.44,问题就可以解决。
如果已经升级了应该怎么降级呢?
将composer.json文件中的
"topthink/think-orm": "^2.0"
改为
"topthink/think-orm": "2.0.44"
然后运行
composer update
即可。MySQL 的下载地址:MySQL :: Download MySQL Community Server
得到的压缩包解压后,打开命令行提示符的管理员模式。
安装mysql服务:
D:\Server\MySQL\mysql-8.0.27-winx64\bin>mysqld --install
Service successfully installed.
初始化mysql
D:\Server\MySQL\mysql-8.0.27-winx64\bin>mysqld --initialize --console
2021-10-27T12:44:56.110412Z 0 [System] [MY-013169] [Server] D:\Server\MySQL\mysql-8.0.27-winx64\bin\mysqld.exe (mysqld 8.0.27) initializing of server in progress as process 9472
2021-10-27T12:44:56.441555Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2021-10-27T12:45:04.292406Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2021-10-27T12:45:16.275942Z 0 [Warning] [MY-013746] [Server] A deprecated TLS version TLSv1 is enabled for channel mysql_main
2021-10-27T12:45:16.276340Z 0 [Warning] [MY-013746] [Server] A deprecated TLS version TLSv1.1 is enabled for channel mysql_main
2021-10-27T12:45:16.423013Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: <H2MriERvPHB
root用户的初始密码是:<H2MriERvPHB
使用初始密码登录root用户
D:\Server\MySQL\mysql-8.0.27-winx64\bin>mysql -uroot -p
Enter password: ************
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.27
Copyright (c) 2000, 2021, Oracle and/or its affiliates.
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.
mysql>
需要先修改密码,同时修改mysql8的密码验证方式,否则第三方工具可能连接不上
mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '123456789';
Query OK, 0 rows affected (0.12 sec)<br/>
刷新权限
mysql> flush privileges;
Query OK, 0 rows affected (0.11 sec)
好了,可以链接了
--------------------------------------------------
添加一个新的管理员用户,需要用两行语句实现:
首先是创建用户:
create user 'user'@'localhost' identified with mysql_native_password by '12345678';
然后再赋予仅限:
grant all on *.* to 'user'@'localhost' with grant option;
更新一下:
flush privileges;
这样就可以用新的用户进行登了。
enjoy!