Java 17 Recipes
Download 3.2 Mb. Pdf ko'rish
|
Java 17 Recipes
- Bu sahifa navigatsiya:
- Listing 12-4.
Listing 12-3. Log of Database Connection
C:\mysql\bin>mysql -u root -p Enter password: ************ Enter password: ************ Welcome to the MySQL monitor. Commands end with ; or \g. Chapter 12 Working With Databases 426 Your MySQL connection id is 8 Server version: 8.0.27 Copyright (c) 2000, 2021, Oracle and/or its affiliates. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> Now the command-line interface (CLI) is activated, note the change in the highlighted prompt command. We recommend changing the password with the following command. mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'root'; The string highlighted in bold is the new password. Then, run the following command. mysql> FLUSH PRIVILEGES; It tells the server to reload the grant tables, which puts your new changes into effect. Finally, if you want to stop the database enter exit in the prompt to stop the command-line client and then type the following. C:\mysql\bin>mysqladmin.exe -u root -p shutdown Enter password: **** The mysqladmin command invokes the administrative utility to connect to MySQL server as root user and tell it to shut down. Listing 12-4 is the message shown on the console. Listing 12-4. Log of Server Shutdown 2021-10-31T19:46:01.347489Z 8 [System] [MY-013172] [Server] Received SHUTDOWN from user root. Shutting down mysqld (Version: 8.0.27). 2021-10-31T19:46:01.347680Z 0 [System] [MY-013105] [Server] C:\mysql\bin\mysqld.exe: Normal shutdown. 2021-10-31T19:46:01.970912Z 0 [System] [MY-010910] [Server] C:\mysql\bin\mysqld.exe: Shutdown complete (mysqld 8.0.27) MySQL Community Server - GPL. Chapter 12 Working With Databases 427 Now you can create and populate your database and follow along with the examples in this chapter. Run the ApressBookDatabase_create.sql script to create a database user schema and populate it. We suggest you work with the database we created in MySQL, even if you are able to develop Java applications that work with Oracle database, PostgreSQL, and all traditional RDBMSs. First, define a simple database called apressBooks with recipes and publications tables. The logic design of the database is shown in Table 12-1 and Table 12-2 , characterized by name, length, type of data, and constraints (i.e., a field is a primary key and another must be not null). Download 3.2 Mb. Do'stlaringiz bilan baham: |
Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling
ma'muriyatiga murojaat qiling