When executing commands in Ubuntu sudo apt-get install mysql-server5.1 installation when actually did not prompt me to enter the MySQL password and so on the information, but when installed in the terminal after the direct input MySQL can directly into MySQL, although can enter MySQL but I do not know the MySQL password, so this time installed M Ysql is equivalent to no installation, because the program can not be used to operate the MySQL database (because the operating database requires the MySQL data password), in order to solve the Ubuntu MySQL password initialization method There are two ways:
(1) Open the/etc/mysql/debian.cnf file, in this file has the system default to our assigned user name and password, through this password can be directly to the MySQL operation. But generally this password is more strange, very long.
(2) Change MySQL password after entering MySQL: This method is better, the specific operation is as follows with command: Set password for ' root ' @ ' localhost ' = password (' Yourpass '); You should be able to work with MySQL after you modify it.
The data password setting after installing MySQL in Ubuntu