MysqlBackup from C# remote server - c#

I'm trying to do database backup using MysqlBackup library ( http://mysqlbackupnet.codeplex.com/ ).
When I'm working with my local Mysql Server everything is ok. I tried to connect to my website database, I receive exception:
Access denied for user <...> using password "YES"...
I know that I'm using correct data, maybe I need special settings on server to allow remote connections ?
When I'm connecting from PHP, the db server that I use is "localhost", in C# application I'm using as server my site address.

It's definitely remote connection not enabled, problem.
Just Google How to Enable Remote MySQL Connection in cPanel
Here is the answer below URL:
CPanel Guide for this
You probably can't enable full remote connection access without root access to your server most likely if your server doesn't have ssh running then the best you can do is just add your ip address so mysql will allow you to connect from your C# program's IP address. Which the guide above tells you how to do.
Enable Remote MySQL Connections in cPanel
Remote MySQL connections are disabled by default in cPanel servers because they are considered a potential security threat. Using the tools in the Web Host Manager (WHM) and the domain-level cPanel interface (usually http://domainname.com/cpanel) remote hosts can be added which the server allows to connect to the MySQL service.
Please note that Liquid Web Shared customers are not permitted to use remote MySQL connections in order to ensure the security of the other customers on the same server. This guide pertains to Dedicated and VPS customers running Linux servers with cPanel.
Before using either of the following techniques, you will need to to open up port 3306 in your server’s firewall.
Enabling Remote MySQL in the WHM Interface
Log in to the server’s WHM interface and find the section in the left-side navigation bar labeled SQL Services. Click on the link marked Additional MySQL Access Hosts:
On the following page, enter one or more hosts or IP addresses in the text box (1) and click the Save button (2). If you wish to activate these settings on all user accounts see (3).
Now that the remote connection has been activated in the WHM each domain account that wants to use the remote connection will need to activate it in their own cPanel interface.
Enabling Remote MySQL in the Domain cPanel Interface
Using the X3 cPanel theme:
Log in to the domain’s cPanel interface and find the section on the main page labeled Databases.
In the Databases section find the link/button labeled Remote MySQL and click on it.
The following page will appear in your browser. Add a hostname or IP address that you want to grant remote MySQL access to (1) and then click the Save button (2).
If a host or IP address needs to be removed from this list you can click the red X next to the entry in the list.

Related

Login to SQL server on an application server with single user

I am making an application in C# that is supposed to work As CLIENT/SERVER architecture the application accesses to the server only to connect to the database. When I started developing the application I found that I had to make a connection string to access the database and then I made the following $"Server = {server}; Database = {dataBase}; Trusted_Connection = True;" which is working now and went to do a test on a machine where the local windows user does not have access to the SQL Server and hence I noticed that only
user at the time of creating the SQL instance in the Mixed Mode option
is one that have access to the SQL server if you are logged in to windows and are using the application. With little experience in developing such applications, I decided to come here to find help in how we can overcome this kind of challenges in desktop applications for .NET. Thanks in advance!
Windows SQL server uses the currently logged in windows user [At the server] to authenticate a connection request. For remote computers, this may not be effective. Rather, it's better to use the username and password authentication method for remote hosts. Kindly make sure that your server is set to mixed mode authentication and follow the following steps.
Create a new user who uses username and password to login. Visit [https://www.supremainc.com/en/node/618] as suggested by Aqib
From the windows firewall, allow incoming connections to access SQL server from outside computers by setting inbound rules in your firewall to allow connections through SQL server port. You may need to check the port your SQL server is listening to though the default port is 1433.
Visit [https://docs.syskit.com/spdockit/v7/faq/troubleshooting-sql-server-connection/inbound-traffic/] for instructions on how to setup the firewall
Make sure that the remote computer is connected to the server. You can do a simple ping to the server. You can use ip-address or server-name / url for checking the connection. [https://iihelp.iinet.net.au/How_to_run_a_ping_test]
Make sure your SQL server is started and run your application on the remote computer.
Thank you
If you want to use a SQL user, you first need to create a SQL user with the appropriate permissions (usually datareader and datawriter) on the database
How to create a SQL user on a database
Then instead of using Trusted Connection, you need to explicitely define the username and password in the connection string like this:
Server=myServerAddress;Database=myDataBase;User Id=myUsername;Password=myPassword;
You can use SQL connection strings website as a reference for the various options

Why my visual studio 2015 SQL Server doesn't connect with Azure SQL Database?

I have a SQL Server running on Microsoft Azure. I want to connect it to My Project in Visual Studio 2015 Community. I have added my IP address in firewall on server. I have also made my port 1433 open for sql. But when I try to connect to database this error shows up. Error Message in SQL Server
It appears that this is a two step process and you either missed the VM configuration or the Azure configuration. Based on what you said I believe it is the Azure configuration that may have been missed. This blog post appears to highlight the necessary things that need to be done to connect.
https://blogs.msdn.microsoft.com/ggaurav/2014/01/08/connect-to-sql-database-on-azure-iaas-from-ssms/
Below is an excerpt:
The two settings which you have to make sure you are checking are :
Endpoint is configured for the port on which SQL server is listening ( generally 1433) on the VM machine.
Ports are opened on the VM machine. Even though as per the documentation Cloud adaptor takes care of opening the firewall ports,
it doesn’t work for the normal connections which you are trying to
make. Just type in ” wf.msc” and create a rule for both outgoing and
incoming for TCP port 1433.
As soon as you are done with these two, you would be able to connect
to the SQL server on the VM machine.
According to your description, I guess your SQL database is a Azure service, not install SQL on Azure VM.
If I understand it correctly, we should check SQL database firewall settings and confirm the name of your database.
The error code means, this error could occur because either the
firewall on the server has refused the connection or the server is not
configured to accept remote connections.
We can via Azure Portal to check the firewall settings:
Make sure the Allow access to Azure Services is ON,
And make sure your client IP address have added to the Client IP address list.
Also we should confirm the name of your database, make sure we are connect to the right SQL database.
I have also made my port 1433 open for sql. But when I try to connect to database this error shows up.
You also need to enable 1433 port in Network Security Group which related to your VM. Steps below are for your reference.
Find the Network Security Group name which related to your VM in Netowrk interfaces panel.
Open this NSG, click [Add] button in the Inbound security rules panel
Add a rule as following.
After that, we could access the database hosted in VM using following server name format.
Server name format.
[IP address/dns name],1433
For example,
13.81.50.123,1433

Need help in SQL Server Remote Access

how to connect two laptops to share a database using windows form application? i mean i've installed mssql server 2008 in my laptop, i need to make windows form application so my friend can modify the database from his laptop, it's not in LAN , we have to use Internet as medium to connect, it'd be helpful if anyone can show me some directions like how connection strings should be. thanks :)
You should consider looking into this. If you search for Error 40 or Error 26 SQL Server. You will get lot of links for connecting SQL Server remotely both on LAN and WAN.
Take a look at this link as well. Screenshots are added here
There are multiple steps involved
Enable default login (sa) - not a good practice
Enable remote connection on sql server
Enable SqlBrowser service - either through Sql Server configuration manager or type services.msc on Run(Ctrl + R)
Add SqlBrowser.exe to firewall exception
Open TCP port 1433 and add it to firewall
Enable TCP, NamedPipe in Sql Server Configuration manager.
Check your public IP using any site like Seemyip.com
Give this IP to your friend along with sql server instance name
On remote machine - enter IP\ServerName with credentials for sa.
OP you just need a dynamic DNS Record (for free at dyndns.org) and then you can create a port forwarding on your Router/Firewall to your SQL server.
That way your SQL Server will be accessible over the internet. Just update your connection string with the dynamic DNS entry that you registered.
This link would be helpful to set the configuration.The link tells how to manipulate connection string according to scenarios.
Here is your:
Server=myServerName\myInstanceName;Database=myDataBase;User Id=myUsername;
Password=myPassword;

i can't access to mysql database from c#

i have a web site and in it's phpmyadmin create a database and i want to connect to it from c#.
i use MySQL connector for .NET in visual studio 2010.
my String Connection is :
server=158.58.185.197;database=porbarco_base;uid=****;pwd=****;CharSet=utf8;
but i can't connect to database and give an error : Unable to connect to any of the specified MySQL hosts.
How i can connect to this database.
i see many threads in stackoverflow but don't solve my problem.
The likelyhood is that the problem is less your C# and more remote access to MySQL
You need to check the following.
Is MySQL listening a network address. Check your mysql configuration file. Look for an entry for bind address. if its set to 127.0.0.1 then you are just listening on localhost, change it to 0.0.0.0 and remember to restart the service
Is your linux firewall blocking remote access to the mysql port.
Does your mysql allow remote access for the specified user from a remote host. see This link for an example of how to set this up
If you are trying to access it directly using the IP address then the port 3306 needs to be open. Is the port open? If the application is hosted on the same server as the database then I would recommend using localhost to access it instead of the IP address.

mysql remote server access from C# application

I have done a small C# Win Forms application, that connects to mySQL database using mySQLconnector. This works perfectly ok with my localhost.
String ConnectionString = "server=xx.xxx.xx.xxx;uid=myuserid;pwd=mypassword;database=dbname";
But I do get following error when I try to connect to remote server:
Unable to connect to any of the specified MySQL hosts.
{"No connection could be made because the target machine actively refused it xx.xxx.xx.xxx:3306"}
I have pinged the server from command prompt and I get response.
I also verified mySQL server settings in remote server database (correct name/ip, portno:3306, skip networking:OFF)
The remote server is accessible without any problem from web server that runs php script and uses same settings as the connection sting I listed above.
The mySQL server is hosted on external shared hosting company 123reg.co.uk with me logging to phpmyadmin using same uid/passwd as like in connection string.
I can't understand what is different between webserver accessing OK, but my C# app having trouble with it??
Can any one please help...
Thanks in Advance
Sam
I've had issues with servers setup so they won't accept remote connections. This is for security reasons mainly. Some places will let you enable it in the CP, but if you have direct access to the server, you should be able to follow these steps.
http://www.rackspace.com/knowledge_center/article/mysql-connect-to-your-database-remotely
Your ip address will be different from the web server.
If your ip address is static you can grant access to your ip address within your mysql database ( https://www.google.com.au/search?q=mysql+grant+access+to+user+from+host ).
I'd recommend using the server to access the database and make your c# application talk to your webserver using ajax/json calls ( https://www.google.com.au/search?q=C%23+Win+Forms+ajax+json ) - that way you're not tied to an ip address for access.
Alternatively you can look at setting up ssh tunnels to your webserver if remote shell access is available so you can get the same access as your webserver. ( https://www.google.com.au/search?q=ssh+tunnels+example+mysql That's what I do myself)

Categories

Resources