How to reinstall MySQL in Ubuntu

Source: Internet
Author: User
Due to Operation errors, I uninstalled Mysql under Ubuntu and had to reinstall it. After a long time, I did not install it, run # sudoapt-getremovemysql-server # sudoapt-getinstallmysql-server and then execute/usr/bin/mysqld_safe & amp; the following error is prompted: Can't connect tolocalmysqlserverthroughsock due to operation errors, after I uninstalled Mysql in Ubuntu, I had to reinstall it. After a long time, I didn't install it. Run

# Sudo apt-get remove mysql-server

# Sudo apt-get install mysql-server

Then run/usr/bin/mysqld_safe & the following error is prompted

Can't connect to local MySQL server through socket '/var/run/mysqld. sock' (2)

Indeed, there is no mysqld. sock file under/var/run/mysqld, and another error is:

/Etc/init. d/mysql: WARNING:/etc/mysql/my. cnf cannot be read. See README.Debian.gz

There is no my. cnf file under/etc. There is no way to do this, because the level is limited.

Finally, find a solution and execute

# Sudo apt-get install mysql-server mysql-common

Modify the mysql logon Password

# Sudo mysqladmin-u root-p password 'newpassword'

It mainly uses the mysql-common package, my. files such as cnf are from mysql-common, but before installation, it is best to clean all the mysql data that has been installed before. Other problems may occur during installation by name.

I learned about mysql.
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.