‘ID‘ int(11) NOT NULL auto_increment, ‘Name‘ char(35) NOT NULL default ’’, ‘CountryCode‘ char(3) NOT NULL default ’’, ‘District‘ char(20) NOT NULL default ’’, ‘Population‘ int(11) NOT NULL default ’0’, PRIMARY KEY (‘ID‘) ) ENGINE=NDBCLUSTER  DEFAULT CHARSET=latin1; INSERT INTO ‘City‘ VALUES (1,’Kabul’,’AFG’,’Kabol’,1780000); INSERT INTO ‘City‘ VALUES (2,’Qandahar’,’AFG’,’Qandahar’,237500); INSERT INTO ‘City‘ VALUES (3,’Herat’,’AFG’,’Herat’,186800); (remaining INSERT statements omitted) 

This must be done for the definition of each table that is to be part of the clustered database. The easiest way to accomplish this is to do a search-and-replace on the file that contains the definitions and replace all instances of TYPE= engine_name  or ENGINE= engine_name  with ENGINE=NDBCLUSTER . If you do not want to modify the file, you can use the unmodified file to create the tables, and then use ALTER TABLE  to change their storage engine. The particulars are given later in this section. 

Assuming that you have already created a database named world  on the SQL node of the cluster, you can then use the mysql  command-line client to read city_table.sql , and create and populate the corresponding table in the usual manner: 

shell> mysql world < city_table.sql 

It is very important to keep in mind that the preceding command must be executed on the host where the SQL node is running (in this case, on the machine with the IP address 198.51.100.20 ). 

To create a copy of the entire world  database on the SQL node, use mysqldump  on the noncluster server to export the database to a file named world.sql  (for example, in the /tmp  directory). Then modify the table definitions as just described and import the file into the SQL node of the cluster like this: 

shell> mysql world < /tmp/world.sql 

If you save the file to a different location, adjust the preceding instructions accordingly. 

Running SELECT  queries on the SQL node is no different from running them on any other instance of a MySQL server. To run queries from the command line, you first need to log in to the MySQL Monitor in the usual way (specify the root  password at the Enter password:  prompt): 

shell> mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 1 to server version: 8.0.26-ndb-8.0.26 Type ’help;’ or ’\h’ for help. Type ’\c’ to clear the buffer. mysql> 

We simply use the MySQL server’s root  account and assume that you have followed the standard security precautions for installing a MySQL server, including setting a strong root  password. For more information, see Section 2.10.4, “Securing the Initial MySQL Account” . 

It is worth taking into account that NDB Cluster nodes do not  make use of the MySQL privilege system when accessing one another. Setting or changing MySQL user accounts (including the root  account) effects only applications that access the SQL node, not interaction between nodes. See Section 23.5.17.2, “NDB Cluster and MySQL Privileges” , for more information. 

If you did not modify the ENGINE  clauses in the table definitions prior to importing the SQL script, you should run the following statements at this point: 

