Install mysql in Ubuntu and mysql in ubuntu
If Mysql has been installed on the machine before, it is best to uninstall the previous content before re-installing Mysql. Otherwise, unexpected problems may occur.
/*** @ Author jenkiHuang * @ email jenkiHuang@qq.com * @ version 20150402 * // delete an existing mysql, clear residual data sudo apt-get autoremove -- purge mysql-server-5.0sudo apt-get remove mysql-serversudo apt-get autoremove mysql-server // this very important sudo apt-get remove mysql-common // install mysqlsudo apt-get install mysql-server // log on to mysqlmysql-uroot-p // restart mysqlsudo service mysql restart
After running the preceding command, you can log on to the mysql database locally. However, if it is developed by multiple developers in the project team, there must be multiple users connected to the database. In this way, you must modify the database configuration file.
// Remotely connect to mysqlsudo vi/etc/mysql/my. cnf // find bind-address = 127.0.0.1 // comment out this line, for example: # bind-address = 127.0.0.1 // or change to: bind-address = 0.0.0.0 // allow access from any IP address; you can also specify an IP address. // Restart MySQL: sudo/etc/init. d/mysql restart // authorize the user to remotely connect to grant all privileges on *. * to root @ "%" identified by "123456" with grant option; // refresh the permission information and the setting takes effect immediately. flush privileges;
Reprinted: http://www.jenkihuang.com/experience/2015/04/ubuntu-install-mysql.html