Home > CMS Tutorial > Discuz > body text

How Discuz solves the error run_sql_error during installation

咔咔
Release: 2020-05-16 09:00:51
Original
3031 people have browsed it

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

  1. VMware virtual machine

  2. ##Centos7.3

  3. PHP7.0

  4. MySQL8.0

  5. NGINX1.14

  6. 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.

How Discuz solves the error run_sql_error during installation

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

How Discuz solves the error run_sql_error during installation

Use xsheel to connect, in The virtual machine uses ifconfig to check the IP address


How Discuz solves the error run_sql_error during installation

and then connects. You need to enter the account password. The account password is your virtual machine account password


How Discuz solves the error run_sql_error during installation

The connection looks like the following if the connection is successful. You can enter PHP -v to view the PHP version information

How Discuz solves the error run_sql_error during installation

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

How Discuz solves the error run_sql_error during installation

After the connection is successful, you can obtain the virtual machine file

How Discuz solves the error run_sql_error during installation

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.

How Discuz solves the error run_sql_error during installation

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
Copy after login

How Discuz solves the error run_sql_error during installation

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

How Discuz solves the error run_sql_error during installation

Click to confirm, and there will be no error report

How Discuz solves the error run_sql_error during installation

Just visit the forum OK

How Discuz solves the error run_sql_error during installation

Viewing the database

How Discuz solves the error run_sql_error during installation

The number of tables viewed is 292 in total


How Discuz solves the error run_sql_error during installation

Then go to the locally installed database and check that the number is also 292

How Discuz solves the error run_sql_error during installation

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template