Home  >  Article  >  Database  >  What are the MySQL database connection methods and tools?

What are the MySQL database connection methods and tools?

PHPz
PHPzforward
2023-05-29 10:13:383826browse
    ##1. MySQl command line client

    After the Mysql installation is completed, the Mysql command line will be automatically configured on the computer. Find MySql 8.0 in the menu Command Line Client, enter the password to enter. (The password is set during the installation process)

    What are the MySQL database connection methods and tools?

    What are the MySQL database connection methods and tools?

    2. CMD command to connect

    1. Press Run win r and enter the command line

    and then cd to the bin directory of mysql, for example

    cd D:

    cd D:\Program Files\MySQL\ MySQL Server 8.0\bin

    mysql -u root -p 123456

    2. Or go directly to the bin directory and enter cmd

    ## in the directory box.

    What are the MySQL database connection methods and tools?

    #mysql -u root -p 123456

    3. Enter directly, but you must configure the environment.

    Hold win r to enter the command line

    mysql -u root -p 123456

    Note: -u is followed by the user name, -p For the password

    What are the MySQL database connection methods and tools?

    If there is no environment configuration, entering "mysql -u root -p" will cause an error. Add the bin directory of Mysql to the path variable path to configure the environment variable

    What are the MySQL database connection methods and tools?

    What are the MySQL database connection methods and tools?

    during the learning process For faster entry, you should choose the third method, configure the environment, win R to enter the command box, and enter mysql -u root -p 123456 to operate the database.

    3. MySQL graphical management tool

    Mysql graphical management tool adopts C/S architecture, and users connect and operate through client software installed on the desktop computer The MySQL database in the background and the client are graphical user GUIs. The software used by beginners is introduced below.

    1. Use of Navicat Premium

    Navicat Premium is a set of database management tools that allows you to connect to MySQL, MariaDB, SQL Server, SQLite, Oracle and PostgreSQL databases. Additionally, it is compatible with Drizzle, OurDelta, and Percona Server and supports cloud databases such as Amazon RDS, Amazon Aurora, Amazon Redshift, SQL Azure, Oracle Cloud, and Google Cloud.

    You can search for the cracked version when downloading

    First open Navicat Premium and click Connect Mysql,

    Then enter the user name and password.

    What are the MySQL database connection methods and tools?

    What are the MySQL database connection methods and tools?

    What are the MySQL database connection methods and tools?

    What are the MySQL database connection methods and tools?

    What are the MySQL database connection methods and tools?

    What are the MySQL database connection methods and tools?# Overall it is very useful and suitable for novices

    2. Use of DataGrip

    DataGrip is a database management product launched by JetBrains. Developers are certainly familiar with JetBrains. IDEA and ReSharper are both products of this company, and the user experience is very good. If we can use a development software, we can significantly improve work efficiency, which is in line with the saying "If a worker wants to do his job well, he must first sharpen his tools."

    After the installation is completed, open it and enter the main page. I believe students who have used IDEA will feel very friendly. The interface is as follows.

    What are the MySQL database connection methods and tools? In the panel, the upper left part lists the established database connections. Click on each item, and the configuration information of the current connection will be displayed on the right. In the General panel, You can configure database connection information, such as host, user name, password, etc. The configuration information of different databases is not exactly the same. Fill in the database URL. Note that there is an option after the URL. You can choose to fill in the URL directly, so there is no need to fill it in separately. Host name, port and other information.

    What are the MySQL database connection methods and tools?

    The Driver section displays the database driver information. If you have not downloaded the driver, there will be a warning at the bottom indicating that the driver is missing.

    Then directly Just click Install and it will be installed automatically.

    What are the MySQL database connection methods and tools?

    #Once the connection is successful, you can start the operation. First open the console, which contains previously saved commands, and you can also create a new command box. The most convenient thing is that it can be operated directly in the window.

    Next, we will use DataGrip to complete common database operations, including querying data, modifying data, creating databases, tables, etc.

    Create a database:

    Right-click in the left frame-->New-->Click database.

    What are the MySQL database connection methods and tools?

    What are the MySQL database connection methods and tools?

    You can see that he will automatically generate the code, which is awesome!

    Create a data white table:

    What are the MySQL database connection methods and tools?

    Make modifications:

    What are the MySQL database connection methods and tools?

    What are the MySQL database connection methods and tools?

    Some shortcut keys and useful functions of DataGrip:

    1. Keyword navigation

    When in When writing sql in the text editing area of ​​datagrip, hold down the Ctrl key on the keyboard and move the mouse to the sql keyword, such as the table name, field name, or function name. The mouse will change into a hand shape and the keyword will change Blue, and underlined, click it, it will automatically locate the object tree on the left, and select the clicked object

    2. Quickly navigate to the specified table, view, function Wait

    In datagrip, use the Ctrl N shortcut key to pop up a search box, enter the name you want to navigate, and press Enter

    3. Global search

    Press the shift key twice in succession, or click the search icon in the upper right corner with the mouse to pop up the search box and search for anything you want to search

    4. Result set search

    Click the mouse in the query result set view area, press the Ctrl F shortcut key, a search box will pop up, enter the search content, and support regular expressions and filtering Result

    5. Row to column

    For tables with many fields, you need to push left and right to view the data. You can switch to column display. Use the Ctrl Q shortcut key in the result set view area

    6. *Wildcard automatically expands

    When querying, we will use select_query all columns , this is a bad habit. Datagrip can quickly expand columns. Position the cursor behind _ and press the Alt Enter shortcut key

    7. Automatic uppercase conversion

    It is a good habit to use uppercase for sql. If you use lowercase, you can stay with the cursor on the field or table name that needs to be converted, and use the Ctrl shift U shortcut key to automatically convert

    8, sql formatting

    Select the sql code that needs to be formatted and use the Ctrl Alt L shortcut key

    9 , Column editing

    Hold down the Alt key on the keyboard and press the left mouse button at the same time to drag. You can select multiple columns, copy and paste, etc.

    10. Code history

    In the text editor, you can view the used sql history through email, local history, show history

    Learn some shortcut keys, It will also improve our learning efficiency.

    4. Using Mysql on different computers

    phpstudy is an integrated PHP running environment. Although it is a software, its function is to give scripts written in PHP language An executable environment can provide a good testing environment for debugging the back-end program before it is officially uploaded to the server.

    First open the service, click to start VNMP, and then click to start Apache and Mysql in the package. FTP depends on the situation. Nginx service and Apache are of the same type. Personally, I recommend Apache as the second choice. First, specifically distinguish yourself from Baidu.

    If the Mysql service has been installed on this machine, you need to uninstall the Mysql service on this machine before you can use phpstudy. The same applies to other services (Apache or PHP).

    What are the MySQL database connection methods and tools?

    The above is the detailed content of What are the MySQL database connection methods and tools?. For more information, please follow other related articles on the PHP Chinese website!

    Statement:
    This article is reproduced at:yisu.com. If there is any infringement, please contact admin@php.cn delete