http://wiki.ubuntu.org.cn/MySQL%E5%AE%89%E8%A3%85%E6%8C%87%E5%8D%97
Install MySQL
sudo apt-get install Mysql-server
This should be very simple, and I think everyone in the installation is not too much problem, so it is not much to say, the following we talk about configuration.
Configure MySQL
Note that the MySQL default in Ubuntu is only allowed for local access, if you want to be able to access other machines, then you need to change the/ETC/MYSQL/MY.CNF configuration file! Below we step by step:
The root user does not have a password after the default MySQL installation, so first use the root user to enter:
$mysql-U Root
Here the reason for using-u root is because I am now a general user (Firehare), if you do not add-u root, MySQL will assume that it is firehare log in. Note that I do not have access to root user mode here because it is not necessary. In general, the database in MySQL operation, there is no need to enter the root user mode, only in the setting of this possibility.
After entering MySQL, the most important thing is to set up the root user password in MySQL, otherwise, the MySQL service is not safe to say.
Mysql> GRANT All privileges on * * to [e-mail protected] identified by "123456";
Note that I use 123456 as the root user's password, but the password is not secure, please use a combination of uppercase and lowercase letters and numbers, and not less than 8 bits.
In this case, you set up the root user password in MySQL, and then use the root user to build the database you need. Here I take xoops as an example:
mysql>CREATE DATABASE xoops;
Mysql>GRANT All privileges the xoops.* to [e-mail protected] identified by "654321";
This establishes a xoops_roots user, which has full access to the database Xoops. After the use of Xoops_root to the Xoops database management, and no need to use the root user, and the user's permissions are only limited to the Xoops database.
If you want to do remote access or control, then you need to do two things:
One
Mysql>GRANT all privileges on xoops.* to [email protected] '% ' identified by ' 654321 ';
Allows xoops_root users to log in to MySQL from any machine.
Second:
$sudo gedit/etc/mysql/my.cnf
In the old version
>skip-networking = # skip-networking
In the new version
>bind-address=127.0.0.1 = bind-address= your machine's IP
This allows other machines to access MySQL.
Start the restart
In the startup management init.d the commands for MySQL are
/etc/init.d/mysql Start|stop|restart|reload|force-reload|status
Start
$sudo/etc/init.d/mysql Start
Shut down
$sudo/etc/init.d/mysql Stop
Restart
$sudo/etc/init.d/mysql Restart
MySQL Installation Guide under Ubantu