If MySQL was installed before the machine, it is best to uninstall the previous content before reinstalling MySQL, otherwise unforeseen problems may occur.
/* * * @author Jenkihuang * @email [email protected] * @version 20150402 *//delete existing MySQL, clean up residual data sudo apt-get autoremove- Purge Mysql-server-5.0sudo apt-get Remove Mysql-serversudo apt-get autoremove mysql-server//This one is important. sudo apt-get remove mysql-common//installing Mysqlsudo apt-get Install mysql-server//login mysqlmysql-uroot-p//Restart mysqlsudo service MySQL restart
After executing the above command, you can log in to the MySQL database locally. However, if the project group is developed by many people, there will be many people connected to the database, so you must modify the database configuration file.
//remote connection to MySQLsudo VI/etc/mysql/my.cnf//Find bind-address = 127.0.0.1//comment out this line, such as: #bind-address = 127.0.0.1//or instead: bind-address = 0.0.0.0//allow any IP access, or specify an IP address yourself. //To restart MySQL:sudo/etc/init.d/MySQL Restart//authorized users can connect remotelyGrant all privileges on *. * to Root@"%"Identified by"123456"with grant option;//Refresh permissions information, set to take effect immediatelyFlush privileges;
Reprint: http://www.jenkihuang.com/experience/2015/04/ubuntu-install-mysql.html
Ubuntu install MySQL