Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <windows.h>
- #include <winsock2.h>
- #include <mysql.h>
- int main() {
- MYSQL conexao;
- mysql_init(&conexao);
- // Aqui tenho um servidor mysql rodando no IP: 127.0.0.1 com usuário "dev" sem senha "". ele conecta ao database "test"
- if ( mysql_real_connect(&conexao, "127.0.0.1", "dev", "", "test", 0, NULL, 0) )
- {
- printf("\nConexao ao banco realizada com sucesso!\n");
- }
- else
- {
- printf("Falha de conexao\n");
- printf("Erro %d : %s\n", mysql_errno(&conexao), mysql_error(&conexao));
- }
- system("PAUSE");
- return(0);
- }
Add Comment
Please, Sign In to add comment