How to access database while not connected to server? - mysql

Relevant info: Using Python3, mysql database and mysql connector package for connecting to the database.
I have a program that uses database to get info that it needs and to write to it. On my machine it works well because I'm connected to the local host but on another machine it won't work. Because program will use real server someday, I want to, if program doesn't have access to the server to use copy of a database that will be stored in his files. I'm new to databases and I can't seem to find any remotely relevant info on this. Help on how can I do this or point me in the right direction where to look, thanks.

Related

Creating custom MySQL servers in VB.NET at runtime

I was wondering if it is possible to create custom MySQL servers in VB.NET while working in visual studio at runtime so that if the server already exists it connects and if it isn't there, the code creates the server. I have searched for this everywhere but couldn't find anything. I would appreciate it a lot if someone guides me to the right path.
You could certainly write some .net code to start a MySQL server on your Windows box when an attempt to connect fails. You simply get a cmd.exe console with administrator privileges and give the command net start mysql.
But MySQL must already be installed on the box for that to work.
You might investigate Sqlite. It provides SQL locally to a .net program, storing your tables in a file called whatever.db. It has very similar .net API access to MySQL's Connector/Net and SQL Server's connector. It's in a NuGet package.
I don't completely understand your "custom MySQL servers" requirement. Sqlite gives you a way to use SQL in your application without connecting to a shared server. That may do what you need.
MySQL does have a CREATE SERVER statement in its SQL dialect. The purpose of this statement is to create a connection to another, remote, MySQL server. With that connection you can use the FEDERATED storage engine to access tables in the remote server. Of course, there is no way to run this CREATE SERVER statement unless your program is already connected to a MySQL server.
With respect, your "task which states to create a server at runtime" doesn't make much sense. Is there more to this requirement? What workflow needs this step? Is it part of the installation of some application software on a new box?

How can i grant access to mySQL database to other computer within my house?

I'm a beginner in SQL so i'm sorry if the question is too basic.
I just created a database in MySQL Workbench in my computer and i would like to be able to access and modify the database from another computer within my house. I read some solutions but they all require using some external product, is there a way and how can i do this by the MySQL Workbench GUI, or maybe other functionalities from MySQL?
I also installed MySQL community server on the other computer that i would like to connect my database to.
Thanks!
If it's a home network, and both of you are connected via same router, then you can connect to mysql server on the other device using http://ip_of_machine_running_mysql:3306.
ip_of_machine_running_mysql should be the ip of the machine running mysql server.
Worth to note that you need to allow remote connection to mysql if you haven't already done so when you were doing mysql installation.
The steps for enabling remote access differs for your os(windows, ubuntu, mac), but you can easily find tutorials and how to's for changing such configuration.
https://www.brightfunction.co.uk/connecting-to-mysql-server-across-a-local-windows-network/
https://www.techrepublic.com/article/how-to-set-up-mysql-for-remote-access-on-ubuntu-server-16-04/

How do I migrate a SQLAnywhere 9 db running in a remote server into a mysql server on my machine?

I am working at a company that has some CRM software running in a remote Windows XP server that uses a SQLAnywhere 9 db to store its data; I have access to this remote server with an administrator account.
I would like to extract the db into a .sql file so that I can run the db locally on my machine without affecting the running db in the server (since it is key for the company's day to day operation).
The reason I need this is that we are going to test some BI Software and we need data from this database to test it, but we don't know the structure of the database since the developers of the CRM software didn't give us any documentation on it. So we need to have the database locally so that, without affecting the running CRM, we can:
understand the structure by looking at the DDL
make queries to it to get sample data
I researched a bit, and the most common solution to my problem was to use dbunload on the remote server to unload the db into a reload.sql file that contained what I needed. But most tutorials on the subject mention that I have to stop the db first (which would be catastrophic). If this is the only option, then I guess I am willing to do it on the weekend when the CRM is not used, but I wanted to know if there was another solution first.
If there is no other solution, can you point me to where I can find the proper and safer way to do this?
I have researched a lot, but prior to this day I have never even heard of SQLAnywhere, so I really need all the help I can get. My main concern is doing something that impacts negatively the CRM software.
Thank you.
You can run dbunload across the network, you just have to tell it to do an "external" unload. The default is to do an internal unload which would only work from the machine where the database server is running.
I don't have SQL Anywhere 9 documentation right now to look up the exact switch, but dbunload -? should show you all the possible switches.
Edit:
-an will create a new database and load the data and schema from another data
-xi switch will do external unload and internal reload.
-c parameters to connect to your remote database

MySql Workbench - difference between "Local instance 3306" and "Localhost via pipe"?

Im learning how to build a simple web app using PHP and MySQL. Tools:
-XAMPP for database, web and php servers
-Sublime for writing the code itself
-Mac OSX Yosemite
- Workbench for database creation
I'm having trouble understanding (and finding a good tutorial) how Workbench actually works. If I got things correctly, I need to create a connection between the Workbench (tool) and the database which sits "inside" the database server? In my case, provided by XAMPP.
After I get these two talking, I then create, edit, etc. tables inside this database, right?
Currently I have two MySql connections on the homescreen, please see attached file.
Thanks!
It's basically just the connection/transfer method. You can connect to a MySQL server via a named pipe if such ability is provided by the operating system OR via TCP connection which is generally for network access but also works and is widely used for localhost connections.
It is transparent to the user and should not affect the communication between server and the client. Those two will connect to the same database using different types of communication channels.

multiple machine MySQL through Workbench

I have recently started using MySQL Workbench, hence I apologise if this is not the proper platform to ask this question. I tried to figure out the solution of my own, but could not find any appropriate one.
Here is my situation: At my workplace, we have a huge set of data about the operational and financial figures such as sales, employee, profit, etc for European companies spread over past 7-8 years and new data keeps coming regularly. However, the problem is we work from different remote locations, me in one city and the other two colleagues in a different city. Normally, we share our work files (.xls/.doc) etc through Dropbox. So, we thought of creating a database in MySQL wherein we all can submit/edit/add this data so that we can filter and analyse this data on several ways once the collection is complete. And we plan to use and access it thereafter. We believe that this is ease a lot of our work. So all I want to know is: can all three of us collaborate simultaeousy (in order to add or edit the data) through workbench Server administration, like the way we collaborate our work through Dropbox? I want to be the host (like the administrator) and then want to allow the access to my colleagues.
Thank you for your time and answer. You may also refer me to any site or link to read more about it.
I think you are a bit confused about what MySQL Workbench is.
MySQL workbench is just a data viewer and administration tool that connects to a MySQL server, there's no data "stored" in MySQL workbench, all the data is stored in the server.
MySQL workbench can:
Connect to a MySQL server
Send SQL instructions and show the results: You can create and drop databases, send SQL queries, create and execute stored procedures and functions... all assuming you have the right privileges.
Perform administration tasks: You can create and drop users, grant or revoke permissions, etcétera
But the fact is: all is stored in a MySQL server... so the answer to your question is: Yes, you can work simmultaneously with your colleagues, if and only if all of you can connect to the same database server (as Mike W commented).
Addressing your comments, and clarifying more details:
MySQL is a database server. When you install it in a computer, all data is stored in that computer (aside from replication and other fine details). You should make regular backups of your data (MySQL has tools for that, one is mysqldump). If you want to access the data stored in your database server, you can do it:
By ussing the command-line client,
By using MySQL workbench or another GUI client program, or
By any program that can connect to the database server (via ODBC or specific libraries).
Focusing on MySQL Workbench, and addressing your specific question: If your machine breaks down, you can install the MySQL Server in any other machine, and load the backup into it. You will have to configure that new machine so that any of your coworkers can connect to it (that may imply that a new set of connection parameters is created).