MySQL installation and common use

Source: Internet
Author: User

installation and use of MySQL

Description: MySQL is a multi-threaded, multi-user SQL database, with high performance, high reliability, easy to use and other features.

Installed software Link: Https://pan.baidu.com/s/1smRLkoX Extract code: vd5v

Part I: Installing the database

Installation steps:

1, uninstall the original MySQL, first check the original system there is no MySQL, there is unloading, production environment is generally installed on their own, not the original system with the MySQL.

2, look at the system has not installed ncurses-devel This software, it is the character terminal under the screen control of the basic library. There is no need to worry about, no words themselves on the Internet next also line.

3, this is nothing to say, MySQL needs cmake compile installation, so first put cmake to good.


4, create run user, I was to test, so created MySQL this user, and let him not directly landing, production environment need and project development discuss with what user.

5 ready to work, start to install MySQL, first decompression to/data/soft under.

6, then configure, compile, and install under/data/soft/mysql-5.5.38

cmake-dcmake_install_prefix=/usr/local/mysql-dsysconfdir=/etc/-ddefault_charset=utf8-ddefault_collation=utf8_ General_ci-dwith_extra_charsets=all

7, the database directory is the owner of the group permissions set.

8. Delete the original MySQL configuration file and copy the installed profile to the/etc/directory.

9, the user MySQL identity to execute the initialization script, the development of data storage directory.

/data/soft/mysql/scripts/mysql_install_db--user=mysql--basedir=/data/soft/mysql--datadir=/data/soft/mysql/data /

10, set environment variables, easy to use MySQL command.

11, add system services, easy to chkconfig management.

12. Turn on the MySQL service and see if it starts successfully.

13, the following start to access the database, start without setting the password, so direct mysql-u root can be directly logged in.

The second part: adding and deleting and changing common usage and setting the login password

1, not set the password, the first time you can use mysqladmin-u root password "password" format password, then login will need to login with the password set.

2. View the log file information for the current database service.

3, execute exit or quit can exit the MySQL command interface, back to the shell interface.

4. View the libraries that are included in the current MySQL service.

5. Go to MySQL library and view all the tables in the MySQL library.

6. View the structure of the user table in the MySQL library.

7, create a new library Test-auth

8. Create a new form test_table and view it.

9. Delete the table.

10, delete a library test_auth, see again no more.

11, insert two data in the Test_table table and view.

12, modify the data record, update with the update command.

13, set the root user login MySQL password in the MySQL interface.

14, at this time re-login to use the revised password, with the original set of password is invalid.

15, set the password in the shell interface using mysqladmin-u root-p password ' password ' format. If the password is not set at the beginning, remove the-p option.

16. Delete the data records from the Test_table table in the test library that are table_name to Lisi.

17, delete the user record that is empty for the users field.

18, add a database user named "Xiaoming", allow access from native, have query permission on all tables in test library, verify password is 123456. But no other permissions.

19, create the Pro library, and authorize the IP address for the 192.168.2.104 host connection, the user is "Xiaoming", the password is 123456.

20, view the permissions granted to Xiaoming and revoke permissions.

21,mysql Three formats for backup libraries.

22. View the contents of the backup file.

Grep-v "^--" Mysql-user.sql |grep-v "^/" |grep-v "^$"

23. Restore the Test library.

Delete the table in the library first test_table

The restored command.

Check to see if it recovers.

24, restore the entire library.


MySQL installation and common use

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.