Ununtu installation of MySQL requires three instructions:
1. Directive I
During execution, you will be prompted to enter your password and repeat the password (enter the password directly), as shown in Figure 1, Figure 2
Figure 1:
Figure 2
2. Directive II, Directive III
# Apt-get Isntall mysql-client
# sudo apt-get install Libmysqlclient-dev
3. Check if the installation is successful
If listen is displayed, the installation is successful (Figure 3)
Figure 3
4. Configure MySQL
# MySQL//install successfully initial, MySQL no password, can go directly to MySQL, type # mysql command appears mysql>
# mysqladmin–u User name password ' password '
Set the MySQL user name and password, such as: Mysqladmin–u root pasword ' root ' username and password are root.
# mysql–u User name –p [Enter]//set username and password after entering MySQL instruction. Tip: Enter Password: then enter your password. # service Mysqld start //start MySQL command, prompt: Starting mysqld: [OK], the start is successful. # Netstat–nat //view network status, MySQL default port number 3306. exists, it means that MySQL is already started. # service Mysqld Restart //restart MySQL command.
5. Remote Access
Through the PC MySQL client, remote access to MySQL on Linux, Access failed.
1) First check that your port and access IP are correct.
2) Confirm that your username and password are present and correct.
3) above two points, should be Linux on the MySQL permissions problem, the workaround:
# mysql–u User name –p //Enter MySQL mysql>grant all privileges on * * to ' root ' @ '% ' identifiedby ' admin ' with GRANT option;// Example: Query OK,......, indicating success, grant the root password Admin account permissions. Mysql>flush privileges;//tip: Query OK,......, indicating success
Connect and try it.
4) The above three points are not resolved, should be the firewall does not open 3306 port.
# vi/etc/sysconfig/iptables //Edit iptables if there is no following line of data, add data, there are other reasons, not currently encountered. -A input–m state–state new–m tcp–p tcp–dport 3306–j accept#/etc/rc.d/init.d/iptables Restart //restart firewall.
5. mysql Export import
Export:
# mysqldump–u User name –p database name >/dir1/dir2/xxx.sql
Type the instruction, use your MySQL account, database name: The name of the database you want to export,> to the saved directory of the exported script file.
Hint: Enter password: the password corresponding to the account. Then, look at the script file under specify.
Import:
# mysql–u User name –p database name </dir1/dir2/xxx.sql
You can also export and import using the MySQL Workbench tool.
Export: Database (menu bar)---->reverse Enginner
---> Fill in hostname,port,username,password--->next--->next--->execute-->finish
Import: Navigator The data Import/restore, find the exported database, execute, you can.
6. mysql Other
# Chkconfig–-list | grep mysqld
Check if the MySQL service is booting up (chkconfig mysqld off/on)
MY.CNF (/ETC/MY.CNF)
View MySQL version information.
mysql> use mysqlmysql> show databases;//show Mysql database under mysql> use testmysql> show tables;//Show table under test database
MySQL Linux installation remote access settings (Ubuntu)