terça-feira, 15 de janeiro de 2008

Mysql - Creating Database

Precisei instalar o mysql no meu desktop e não lembrava os comandos, mesmo porque não fazemos isso todo dia... :-P.

Este é mais um guia de consulta rápida do que um tutorial. Então vamos lá.

-> Depois de instalar e iniciar o Mysql, o comando a seguir criará o banco de dados.

[root@fedora root]# mysql_install_db
Installing all prepared tables
Fill help tables

To start mysqld at boot time you have to copy support-files/mysql.server
to the right place for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
/usr/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin -u root -h localhost password 'new-password'
See the manual for more instructions.

NOTE: If you are upgrading from a MySQL <= 3.22.10 you should run
the /usr/bin/mysql_fix_privilege_tables. Otherwise you will not be
able to use the new GRANT command!

You can start the MySQL daemon with:
cd /usr ; /usr/bin/mysqld_safe &

You can test the MySQL daemon with the benchmarks in the 'sql-bench' directory:
cd sql-bench ; perl run-all-tests

Please report any problems with the /usr/bin/mysqlbug script!

The latest information about MySQL is available on the web at
http://www.mysql.com
Support MySQL by buying support/licenses at http://shop.mysql.com
[root@fedora root]#


-> Para criar o banco, entre no mysql:

[root@fedora root]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2 to server version: 5.0.22

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

-> Digite o comando abaixo e pronto.

mysql> CREATE DATABASE mydatabase;
Query OK, 1 row affected (0.00 sec)

Abs!
Wilton Paulo

0 comentários:

Postar um comentário

Gostou do artigo? Então deixe um comentário !!!