The functions implemented in this article
Solution to the run_sql_error error reported by discuz when installing MySQL8.0
If you want to see the solution results directly, go directly to the problem solving directory
Problem environment
VMware virtual machine
- ##Centos7.3
- PHP7.0
- MySQL8.0
- NGINX1.14
- Discuz3.4
Problem restoration
The local environment is PHP5.6 MySQL5.6 without any problems when installing discuz.
The following problem occurs on the centos of the virtual machine. The MySQL table cannot be created and the installation error is reported.
The host uses Xsheel and Ftp
Due to the inconvenience of taking screenshots from the centos terminal, all environment modifications below will be performed on xshell and accessed directly on the host machine.
About configuring how to use xsheel to connect to a virtual machine
The connection mode is NAT, and the tools have been installed
Use xsheel to connect, in The virtual machine uses ifconfig to check the IP address
and then connects. You need to enter the account password. The account password is your virtual machine account password
The connection looks like the following if the connection is successful. You can enter PHP -v to view the PHP version information
The other one is ftp, because it is needed To transfer something, I also used the host's ftp to connect to the virtual machine. In the same way, enter the IP address and the port is 22
After the connection is successful, you can obtain the virtual machine file
Solution to the problem
The root of this problem is the MySQL version. The version supported by discuz is PHP5.3. But all database files are created on MySQL5.5. Therefore, the character set will be garbled.
At this time, we open /etc/my.ini. This is the default configuration. Don’t worry about the mysqldump below. That is the situation where MySQL master-slave replication was configured before to have data. configured.
Add the following code to this file
init_connect='SET NAMES utf8'
default-storage-engine=INNODB
character-set-server=utf8
collation-server=utf8_general_ci
default_authentication_plugin=mysql_native_password
All storage engines in mysql8.0 are innodb , so the default setting here is innodb
The character set is set to utf8
default_authentication_pluginModify the password verification plug-in
After the above configuration, let’s test it
Test
Enter http://192.168.254.130/forum/install/index.php in the address bar, and then continue to the next step. Enter your database account password here
Click to confirm, and there will be no error report
Just visit the forum OK
Viewing the database
The number of tables viewed is 292 in total
Then go to the locally installed database and check that the number is also 292
Summary
The above is the solution for discuz's installation error in MySQL8.0. Although it only requires a few lines of configuration, it cannot be solved in a short time.
The above is the detailed content of How Discuz solves the error run_sql_error during installation. For more information, please follow other related articles on the PHP Chinese website!