Tgrtgr

Páginas: 5 (1062 palabras) Publicado: 7 de agosto de 2012
try executing a SQL file from the command-line shell, download the starter script, place it in the same directory as the SQLite executable, and type the following at the prompt:
sqlite> .read sqlite-start.sql

The output should be the same as with the copy-paste method. To see the full list of SQLite-specific commands like '.read', type '.help' or consult the special commands list in theSQLite command-shell documentation.

When you're finished, type '.exit' to exit the program. Note that the database state is not saved between sessions, so you will have to reload any data from scratch for each session. If you want to avoid this and you're familiar with the command line in your OS, you can execute SQLite from there with a single argument:
sqlite database-filename

This will causeSQLite to open and use the file called 'database-filename', or create it if it does not already exist. The database state will be saved to that file as you work, and you can use it again later.


MySQL

For more detailed instructions, see the official MySQL installation notes.

Windows: Go to the MySQL Community Server download page and select the MSI installer for your architecture (if indoubt, 32-bit is a safe bet). You may choose to register as a new user or proceed with the download without registering. Run the installer (a 'Typical' installation is fine). The installer will then run the MySQL Server Instance Configuration Wizard. Install MySQL as a Windows service and include the bin directory in Windows PATH. Create a root account with appropriately secure password (and onethat you'll remember!), and make sure to disable root access from remote machines. When completed, MySQL will be running as a service on your computer. To connect and use it, select 'MySQL Test User' in the MySQL directory of the Start Menu.

Mac OS X: Go to the MySQL Community Server download page and select the DMG archive for your architecture (if in doubt, 32-bit is a safe bet). You maychoose to register as a new user or proceed with the download without registering. Open the disk image file, and run both of the package installers (MySQL and MySQLStartupItem). All standard settings and installation locations should be fine. To get to the MySQL shell, you will need to open a terminal window and run the following commands:
sudo /Library/StartupItems/MySQLCOM/MySQLCOM start/usr/local/mysql/bin/mysql
The first command starts the MySQL server (it will likely require that you enter your login password to proceed), and the second connects to the server and opens the MySQL shell. Note that the default setup uses no passwords; see the official documentation on securing the initial MySQL accounts to set your own.

Once you're in the MySQL command-line shell, you have threeoptions to run queries: you can type them by hand each time, copy them from somewhere else and paste them into the command-line shell window, or execute a file as a script. To try the latter two options, take a look at our MySQL starter script. If you copy and paste its contents into the MySQL window, it should generate the following output (you may get a warning that the table does not exist on thefirst time you run it; this is OK):
+--------+--------+
| A | B |
+--------+--------+
| Hello, | world! |
+--------+--------+
1 row in set (0.00 sec)

To try executing a SQL file from the command-line shell, download the starter script, place it somewhere that you can easily remember the file path, and type the following at the prompt (where ~PATH~ represents the path to thefile):
mysql> source '~PATH~/mysql-start.sql'

The output should be the same as with the copy-paste method. To see the full list of MySQL-specific commands like 'source', type 'help' or consult the commands list in the MySQL documentation.

When you're finished, type 'quit' to close the connection. The database state will be saved, so all your tables will still be there when you connect again...
Leer documento completo

Regístrate para leer el documento completo.

Conviértase en miembro formal de Buenas Tareas

INSCRÍBETE - ES GRATIS