Difference between revisions of "MySQL"

From wiki.visual-prolog.com

(MySQL and VIP)
(MySQL and VIP)
Line 6: Line 6:
  
  
#'''Download and install MySQL'''<br>See http://www.mysql.com<br>and http://dev.mysql.com/downloads/<br>Download the ''MySQL community Server''<br><br>
+
#'''Download and install MySQL'''<br><br>See http://www.mysql.com<br>and <br>http://dev.mysql.com/downloads/<br>Download the ''MySQL community Server''<br><br>
#'''Configure the Server'''<br>At the end of the installation you will be automatically be prompted to configure the server, via the ''MySQL Server Instance Configuration Wizard''. You can call this wizard at any time from the Windows ''Start-Programs-MySQL'' menu item.<br><br>Select all the defaults for the dialogs as presented by the wizard: it's probably best to use a non-blank password.<br><br>Check that the server is running as a Windows service (''Control Panel - Performance and Maintenance - Administrative Tools - Services'')<br><br>
+
#'''Configure the Server'''<br><br>At the end of the installation you will be automatically be prompted to configure the server, via the ''MySQL Server Instance Configuration Wizard''. You can call this wizard at any time from the Windows ''Start-Programs-MySQL'' menu item.<br><br>Select all the defaults for the dialogs as presented by the wizard: it's probably best to use a non-blank password.<br><br>Check that the server is running as a Windows service (''Control Panel - Performance and Maintenance - Administrative Tools - Services'')<br><br>
#'''Download and install the MySQL ODBC Driver'''<br> See http://www.mysql.com/products/connector/odbc/<br><br>
+
#'''Download and install the MySQL ODBC Driver'''<br><br>See http://www.mysql.com/products/connector/odbc/<br><br>
#'''Create a Datasource'''<br>Go to ''Control Panel - Performance and Maintenance - Administrative Tools - Data Sources (ODBC)''<br>Under the dialog tab ''User DSN'', press ADD, select the ''MySQL ODBC Driver'' (probably version 3.51).<br><br>In the dialog, enter the following:<br>#*'''Data Source Name''': myodbc<br>#*'''Description''':      a test<br>#*'''Server''':          localhost<br>#*'''User''':            root<br>#*'''Password''':        The password you entered for the server in step 2 above<br>#*'''Database''':        fred<br>Press the TEST button - it should connect.<br><br>
+
#'''Create a Datasource'''<br><br>Go to ''Control Panel - Performance and Maintenance - Administrative Tools - Data Sources (ODBC)''<br>Under the dialog tab ''User DSN'', press ADD, select the ''MySQL ODBC Driver'' (probably version 3.51).<br><br>In the dialog, enter the following:<br>
#'''Test the database with the Command Line Client'''<br><br>From the Start-All Prolograms-MySQL menu, start the command line client. Enter the password at the prompt. The prompt should now be:<br>'''mysql>'''<br><br>*Enter "show databases;" (without the quotes, but with the semi-colon), and database "fred" should be listed.<br>*Enter "use fred"<br><br>Now create a table - <br>*Enter "create table person (name varchar(20, age integer);"<br>*Enter "show tables;"  (remember the semi-colons)<br>Enter some data into the table. <br>*Enter "insert into person values('fred','87');"
+
#*'''Data Source Name''': myodbc<br>
 +
#*'''Description''':      a test<br>
 +
#*'''Server''':          localhost<br>
 +
#*'''User''':            root<br>
 +
#*'''Password''':        The password you entered for the server in step 2 above<br>
 +
#*'''Database''':        fred<br>Press the TEST button - it should connect.<br><br>
 +
#'''Test the database with the Command Line Client'''<br><br>From the Start-All Prolograms-MySQL menu, start the command line client. Enter the password at the prompt. The prompt should now be:<br>'''mysql>'''<br><br>
 +
#*Enter "show databases;" (without the quotes, but with the semi-colon), and database "fred" should be listed.<br>
 +
#*Enter "use fred"<br><br>Now create a table - <br>
 +
#*Enter "create table person (name varchar(20, age integer);"<br>
 +
#*Enter "show tables;"  (remember the semi-colons)<br>Enter some data into the table. <br>
 +
#*Enter "insert into person values('fred','87');<br><br>And then check the data is there:<br>
 +
#*Enter "select * from person;"<br><br>and the data should be listed.<br><br>Close the MySQL session:<br>
 +
#*Enter "quit".<br>
  
And then check the data is there:
+
#'''Create a new VIP GUI project'''
 
 
>Enter "select * from person;"
 
 
 
and the data should be listed.
 
 
 
Close the MySQL session:
 
 
 
>enter "quit".
 
 
 
'''6) Create a new VIP GUI project'''
 
  
 
page being developed
 
page being developed

Revision as of 12:41, 25 September 2008

MySQL and VIP

Page under development

This article briefly describes how to install MySQL locally and how to interact with a MySQL DB with a VIP (GUI) program.


  1. Download and install MySQL

    See http://www.mysql.com
    and
    http://dev.mysql.com/downloads/
    Download the MySQL community Server

  2. Configure the Server

    At the end of the installation you will be automatically be prompted to configure the server, via the MySQL Server Instance Configuration Wizard. You can call this wizard at any time from the Windows Start-Programs-MySQL menu item.

    Select all the defaults for the dialogs as presented by the wizard: it's probably best to use a non-blank password.

    Check that the server is running as a Windows service (Control Panel - Performance and Maintenance - Administrative Tools - Services)

  3. Download and install the MySQL ODBC Driver

    See http://www.mysql.com/products/connector/odbc/

  4. Create a Datasource

    Go to Control Panel - Performance and Maintenance - Administrative Tools - Data Sources (ODBC)
    Under the dialog tab User DSN, press ADD, select the MySQL ODBC Driver (probably version 3.51).

    In the dialog, enter the following:
    • Data Source Name: myodbc
    • Description: a test
    • Server: localhost
    • User: root
    • Password: The password you entered for the server in step 2 above
    • Database: fred
      Press the TEST button - it should connect.

  5. Test the database with the Command Line Client

    From the Start-All Prolograms-MySQL menu, start the command line client. Enter the password at the prompt. The prompt should now be:
    mysql>

    • Enter "show databases;" (without the quotes, but with the semi-colon), and database "fred" should be listed.
    • Enter "use fred"

      Now create a table -
    • Enter "create table person (name varchar(20, age integer);"
    • Enter "show tables;" (remember the semi-colons)
      Enter some data into the table.
    • Enter "insert into person values('fred','87');

      And then check the data is there:
    • Enter "select * from person;"

      and the data should be listed.

      Close the MySQL session:
    • Enter "quit".
  1. Create a new VIP GUI project

page being developed