Install Mysql online on ubuntu and perform some operations
Install Mysql online on ubuntu and perform some operations
1. Three commands used to install Mysql:
Open the terminal and enter sudoapt-get install mysql-server.
Enter sudoapt-get install mysql-client.
Enter sudo apt-get install libmysqlclient-dev.
2. installation steps:
Install mysql-server:
Set the mysql login password:
Confirm Password:
Installation result:
3. Install mysql-client:
<喎?http: www.bkjia.com kf ware vc " target="_blank" class="keylink"> VcD4KPHA + IDxpbWcgc3JjPQ = "http://www.2cto.com/uploadfile/Collfiles/20150127/20150127095542108.jpg" alt = "\">
4. Install libmysqlclient-dev:
Installation result:
5. After the installation is complete, run the following command to check whether the installation is successful:
Sudonetstat-tap "grep mysql
If mysql socket is in the listen status, the installation is successful.
6. Enter mysql:
Access result:
7. Some SQL operations:
View All databases:
Create a database:
View the created database:
Enter the specified database:
Create a table:
View fields and some non-empty information:
Insert data:
View table information:
Insert Chinese characters:
Garbled display:
8. Solve the garbled problem:
Run the following command:
Add the following pink area content:
Restart mysql:
9. Verify whether garbled characters are resolved:
RepeatCreate a database:
Enter the database:
Create a table:
Insert data containing Chinese characters:
Query table content:
Normal display of Chinese characters:
Exit mysql, not close:
Close the database:
Result:
10. Some mysql commands:
Start the service:
Sudo/etc/init. d/mysql start
Close the service:
Mysqladmin-u root-p shutdown
Restart the service:
Sudo/etc/init. d/mysql restart
Go to mysql:
Mysql-u username-p
Press enter and enter the password. after entering the password, you can enter it. After Entering the terminal, the command line is changed to mysql>
After entering the mysql interface, the command should end with a; otherwise, the command will not return after execution.
Exit mysql:
Quit;