Installation and use of MySQL under CentOS

Source: Internet
Author: User
Tags server port

1. Using the Install command: yum-y install MySQL mysql-server mysql-devel

Installation completed but found MyServer installation is missing, in the Internet to find the reason, the original is because the CentOS 7 on the default software removed from the list, with mariadb to replace, so this causes we have to go to the official web download, find links, open with wget:

A: #wget http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm

B:RPM-IVH mysql-community-release-el7-5.noarch.rpm

C. Two times for yum-y install MySQL mysql-server mysql-devel, installation is successful. Use the command again, and then get the following information

2.Mysql is divided into Client,server port two ports, if you want to use, first open the server

3. Next enter the client, function command mysql-u root-p Enter password, default is empty

4. Basic operation show databases;

5. Use a database using Chouti to view the table show tables;6. Common Database Operations
 1 MySQL Database use summary 2 This article mainly records some MySQL daily use commands, for later query. 3 1. Change the root password 4 mysqladmin-uroot password ' YourPassword ' 5 2. Remote login MySQL server 6 mysql-uroot-p-h192.168.137.10-p3306 7 3. Query Database 8 show databases;  9 4. Enter a database Use DATABASENAME;11 5. List the tables in the database show tables;13 6. View a table all fields desc slow_log;15 show CREATE TABLE slow_log\g; (You can display not only the table information, but also the built-in statements) 16 7. View the current user (), select User (), 18 8. View the current database (), and 20 9. Creating a new database (you can specify a character set) create Database DB1 CharSet utf8;22 10. Create a new table of all creation table T1 (' id ' int (4), ' name ' char (40)); 24 11. View Database version select version (); 26         12. View the status of the database show status;  Current session status-show global status;   Global database state show Slave status\g; View master and slave database status information 30 13. Querying database parameters for show variables;32 14. Modifying database parameters Variables show like ' max_connect% '; set global max_connect_er  rors = 1000; (Restart the database will be invalidated, modify it in the configuration file) 35 15. View current Database queue processlist;37 Show 16. Create a regular user and authorize a database on the databasename.* to           ' User1 ' @ ' localhost ' identified by ' 123456 '; 39 17. Query the table data. * FROM Mysql.db; Query all fields in this table. SelecT Count (*) from Mysql.user;    COUNT (*) indicates how many rows in the table are db,user from mysql.db; Querying multiple fields in a table a select * from Mysql.db where the host like ' 10.0.% '; You can use the universal match "%" in a query statement 44 18. Insert a row of data into the DB1.T1 values ( 1, ' abc '); 46 19. Change a row of data for a table db1.t1 set name= ' AAA ' where id=1;48 20. Clear table Data db1.t1;50 21. Delete Table Drop T Able db1.t1;52 22. Clears all tables in the database (the database name is EAB12) mysql-n-S Information_schema-e "select CONCAT (' TRUNCATE TABLE ', TABLE_NAME, ‘;‘) From TABLES WHERE table_schema= ' eab12 ' | Mysql-f eab1254 23. Delete Database db1;56 24. Database backup mysqldump-uroot-p ' yourpassword ' MySQL >/tmp/mysql.sql58 25. Database recovery mysql-uroot-p ' yourpassword ' MySQL </tmp/mysql.sql60 26. Create user name identified by ' Ssapdrow ' for new normal users 62 27. Change the password of the ordinary user PASSWORD for Name=password (' FDDDFD '); 64 28. View name User rights: Show GRANTS for name;66 29. Execute MySQL command in script Mys  Ql-uuser-ppasswd-e "Show Databases" "Show Databases" |mysql-uuser-ppassword69 The following is the way to execute a large number of MySQL statements Mysql-uuser -hhostname-ppaSSWD <<eof71 MySQL Statement EOF 

7. As for the table of additions and deletions, due to the additional content, here no longer show. Due to the bandwidth or space limitation of the server (CentOS), it is not likely to be similar to the navicat-like graphical operation like windows, so please be familiar with the corresponding operation of the Black screen window.

Installation and use of MySQL under CentOS

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.