Initialize the password when installing MySQL in Ubuntu

Source: Internet
Author: User
When running the command sudoapt-getinstallmysql-server5.1 installation in ubuntu, I did not prompt me to enter the mysql password and other information, but when the installation is good

When executing the sudo apt-get install mysql-server5.1 installation command in ubuntu, I was not prompted to enter the mysql password and other information, but when it is installed

When executing the sudo apt-get install mysql-server5.1 installation command in Ubuntu, I was not prompted to enter the mysql password and other information, however, after installation, mysql can be directly entered in the terminal. Although mysql can be accessed, I do not know the mysql password, therefore, the mysql installed at this time is equivalent to not being installed, because the mysql database cannot be operated by a program (because the password of mysql Data is required for database operations ),, there are two methods to solve the mysql password initialization in ubuntu:

(1) Open the/etc/mysql/debian. cnf file, which contains the username and password that the system assigns to us by default. With this password, you can directly operate on mysql. However, this password is generally quite strange and very long.

(2) After Entering mysql, modify the mysql password: This method is better. The specific operation is as follows: set password for 'root' @ 'localhost' = password ('yourpass'); after modification, mysql can be operated normally.

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.