Home > Backend Development > PHP Problem > How to reinstall mysql in linux php

How to reinstall mysql in linux php

藏色散人
Release: 2023-03-12 16:10:01
Original
2217 people have browsed it

linux php method to reinstall mysql: 1. Delete mysql through "sudo apt-get remove mysql-common"; 2. Clean up the residual data; 3. Reinstall mysql through "sudo apt-get install" that is Can.

How to reinstall mysql in linux php

The operating environment of this article: linux5.9.8 system, PHP7.1 version, Dell G3 computer

linux php reinstall mysql

MySQL always reports an error, saying that the sock file does not exist. I tried several methods online, changed permissions, and changed the configuration file, but the result was that the .sock file still could not be generated normally. No way, delete and reinstall.

Completely delete:

Delete mysql

sudo apt-get autoremove --purge mysql-server-5.0
sudo apt-get remove mysql-server
sudo apt-get autoremove mysql-server
sudo apt-get remove mysql-common //这个很重要
Copy after login

Some of the above are actually redundant.

Clean up residual data

dpkg -l |grep ^rc|awk '{print $2}' |sudo xargs dpkg -P but the created database file still exists. After reinstallation, it still exists can use.

Install mysql

sudo apt-get install mysql-serversudo apt-get install mysql-clientsudo apt-get install php5-mysql //Installing php5-mysql is Once the installation is complete, the MySQL server should start automatically. You can check if the MySQL server is running by running the following command from the terminal prompt: sudo netstat -tap | grep mysql When you run the command, you can see lines similar to the following:

tcp 0 0 localhost.localdomain:mysql *:* LISTEN -
Copy after login

if server If it cannot run normally, you can start it with the following command:

sudo /etc/init.d/mysql restart
Copy after login

Enter mysql

$mysql -uroot -p administrator password

Configure the administrator password for MySQL:

sudo mysqladmin -u root password newpassword
Copy after login

Okay, done.

Recommended learning: "PHP Video Tutorial"

The above is the detailed content of How to reinstall mysql in linux php. 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