Ir para conteúdo
Faça parte da equipe! (2024) ×
Conheça nossa Beta Zone! Novas áreas a caminho! ×
  • Quem está por aqui   0 membros estão online

    • Nenhum usuário registrado visualizando esta página.
  • 0

Website and database linking


aakarsh98
 Compartilhar

Pergunta

//#define HOST "localhost"
//#define USER "root"
//#define PASS "123456"
//#define PORT 3306
//#define DB "wydsite"

what should be the values when using a hosting service, through cpanel and myphp.
need help setting this when the main server is on a different device/ip/vps
adn the website/database is hosted on a different IP/domain.

Link para o comentário
Compartilhar em outros sites

8 respostass a esta questão

Posts Recomendados

  • 0
1 hora atrás, aakarsh98 disse:

//#define HOST "localhost"
//#define USUÁRIO "root"
//#define PASS "123456"
//#define PORTA 3306
//#define BD "wydsite"

quais devem ser os valores ao utilizar um serviço de hospedagem, através do cpanel e myphp.
preciso de ajuda para configurar isso quando o servidor principal estiver em um dispositivo/ip/vps diferente
e o site/banco de dados está hospedado em um IP/domínio diferente.

 

Quando se trata de hospedagem, cada empresa fornece um padrão diferente.

 

Host -> Geralmente vai ser algo que ligue ao domínio, por exemplo, se for na Azure, vai ser algo como NomeQueVoceUsou.azurewebsite.net

User/Pass -> Sem padrão, mas definitivamente não é root, vai ser algum valor qualquer

Port -> 3306 geralmente não muda, mas pode

Bd -> Banco de dados dentro da instância do banco, provavelmente vai ser um nome aleatório.

 

Todos esses dados vão ser fornecidos pela própria hospedagem, é padrão de mercado.

Link para o comentário
Compartilhar em outros sites

  • 0
1 hour ago, 987987987 said:

 

When it comes to hosting, each company provides a different standard.

 

Host -> It will usually be something that connects to the domain, for example, if it is on Azure, it will be something like NameYouUsed.azurewebsite.net

User/Pass -> No default, but definitely not root, it will be some random value

Port -> 3306 usually doesn't change, but it can

Bd -> Database within the database instance, it will probably be a random name.

 

All this data will be provided by the hosting itself, it is market standard.

can you help me out in pvt, i have put in the details correctly, but the main tm/db server doesnt seem to call and utilize it.

 

Link para o comentário
Compartilhar em outros sites

  • 0
3 horas atrás, aakarsh98 disse:

can you help me out in pvt, i have put in the details correctly, but the main tm/db server doesnt seem to call and utilize it.

 

 

Ajudo sim, mas prefiro que seja aqui.
Outros podem ter esse erro e acaba ajudando indiretamente.

 

Um ponto a verificar é se a conexão está liberada.

O DBSrv pode tentar acessar o banco, mas não conseguir.

 

Para testar, acesse o servidor ( onde o DBSrv é executado ), abra o prompt de comando ( CMD ) e tente chegar no banco através do comando telnet ( se não estiver habilitado, ative nos serviços do windows ou use o putty ):

telnet 127.0.0.1 3306


Troque o valor "127.0.0.1" pelo ip do seu servidor de banco de dados.

Se a tela ficar toda preta ( sem nenhum texto ), é porque está ok a conexão, pode ser configuração.

Se aparecer timeout/erro, verifique o firewall do sistema e do serviço.

 

Geralmente todos os serviços são protegidos por firewall.

Editado por 987987987
Link para o comentário
Compartilhar em outros sites

  • 0
20 minutes ago, 987987987 said:

 

Yes, I can help, but I prefer it to be here.
Others may have this error and it ends up helping indirectly.

 

One point to check is whether the connection is released.

DBSrv may try to access the database but fail.

 

To test, access the server (where DBSrv is running), open the command prompt (CMD) and try to access the database using the telnet command (if it is not enabled, enable it in Windows services or use putty):

telnet 127.0.0.1 3306


Replace the value "127.0.0.1" with the IP of your database server.

If the screen is completely black (without any text), it means the connection is ok, it could be a configuration issue.

If timeout/error appears, check the system and service firewall.

 

Generally all services are protected by firewall.

great, so i tested this and everything works, i even tested this on my own pc trying to connect and access the database. i think its the problem with the code or how it references it.

this is the mysql.h header file

É necessário se cadastrar para acessar o conteúdo.


 



lets assume that i have replaced the database values correctly.

this file below is the .cpp that defines the function, i think its not efficently reading and updating data from the datbase when its hosted on another server, however when i was testing on local machine, it seems to work fine. so if anyone has suggestions on how to fix it , that would be nice.

 

É necessário se cadastrar para acessar o conteúdo.

 

Link para o comentário
Compartilhar em outros sites

  • 0

Antes de qualquer coisa:

 

1 - fez o teste com o telnet? deu sucesso?

2 - Aparece algum erro/log do MySQL ? Parece que o código informaria alguns.

 

Dois computadores se conectando usando redes diferentes requerem configuração adequada.

 

Supondo que o Servidor A ( TM/DB ) quer falar com o Servidor B ( MySQL ), vc tem que garantir que o servidor A pode falar com B. O telnet vai te mostrar isso, se pode um falar com o  outro.

 

Lembrando, se o servidor A tem o ip 45.84.52.41, e o servidor B tem o ip 45.84.52.41, nem sempre vai funcionar vc colocar o ip do servidor B. Se ambos estão na mesma rede interna, eles vão ter um ip diferente, tipo 192.168.0.10 e 192.168.0.11. Neste cenário, o ip que vc colocaria do servidor MySQL seria 192.168.0.11, pois o ip 45.84.52.41 é o ip externo, da internet, que chega nesse servidor.

 

Bem, antes de mais nada, faça o teste com telnet que pedi, então vemos se é firewall ou rede. ( se funciona local, deveria funcionar externamente rsrs, salvo interfaces locais )

Link para o comentário
Compartilhar em outros sites

  • 0
10 hours ago, 987987987 said:

Before anything else:

 

1 - Did you test it with telnet? Was it successful?

2 - Do any MySQL errors/logs appear? It seems like the code would report some.

 

Two computers connecting using different networks require proper configuration.

 

Assuming that Server A (TM/DB) wants to talk to Server B (MySQL), you have to ensure that Server A can talk to B. Telnet will show you this, if one can talk to the other.

 

Remember, if server A has the IP 45.84.52.41, and server B has the IP 45.84.52.41, it will not always work for you to put the IP of server B. If both are on the same internal network, they will have a different IP, such as 192.168.0.10 and 192.168.0.11. In this scenario, the IP that you would put for the MySQL server would be 192.168.0.11, because the IP 45.84.52.41 is the external IP, from the internet, that reaches this server.

 

Well, first of all, do the telnet test that I asked, then we can see if it is a firewall or a network. (If it works locally, it should work externally lol, except for local interfaces)

I think i did not communicate correctly, I did run and test the Telnet command on both my personal pc and vps, its connecting and receiving data from the hosting site.

so now i am debugging the MySQL function within the source code to see how the functions are called and how its responding.

Link para o comentário
Compartilhar em outros sites

  • 0
6 horas atrás, aakarsh98 disse:

Acho que não me comuniquei corretamente. Executei e testei o comando Telnet no meu PC pessoal e no VPS, ele está se conectando e recebendo dados do site de hospedagem.

então agora estou depurando a função MySQL dentro do código-fonte para ver como as funções são chamadas e como elas respondem.

 

Entendendo que existe uma conexão aberta entre origem e banco, veja a questão da versão.

Os conectores funcionam diferente entre 5.6 e 8.0.

Mas acredito que deveria aparecer um erro no conector, as versões do MySQL são iguais?

 

Literalmente não faz sentido ter conexão e não gerar erro, mas não funcionar. Ao menos tentei =)

Link para o comentário
Compartilhar em outros sites

Participe da Conversa

Você pode postar agora e se cadastrar mais tarde. Cadastre-se Agora para publicar com Sua Conta.
Observação: sua postagem exigirá aprovação do moderador antes de ficar visível.

Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Responder esta pergunta...

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emoticons são permitidos.

×   Seu link foi incorporado automaticamente.   Exibir como um link em vez disso

×   Seu conteúdo anterior foi restaurado.   Limpar Editor

×   Você não pode colar imagens diretamente. Carregar ou inserir imagens do URL.

 Compartilhar

×
×
  • Criar Novo...

Informação Importante

Nós fazemos uso de cookies no seu dispositivo para ajudar a tornar este site melhor. Você pode ajustar suas configurações de cookies , caso contrário, vamos supor que você está bem para continuar.