search
HomeBackend DevelopmentPHP ProblemHow to reinstall mysql in linux php

How to reinstall mysql in linux php

Sep 17, 2021 am 09:18 AM
linuxmysqlphp

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 //这个很重要

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 -

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

sudo /etc/init.d/mysql restart

Enter mysql

$mysql -uroot -p administrator password

Configure the administrator password for MySQL:

sudo mysqladmin -u root password newpassword

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!

Statement
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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools