How do I upgrade mysql? - mysql

When upgrading MySQL, I first create a backup of the database. Then I will uninstall the current version installed, and delete all the files that were left by the installer. Then I install the latest GA version, and restore the created back-up, using the MySQL Administrator.
Is there a better way of doing an upgrade of the MySQL. Because I have to create again all the users that are allowed to connect to the database.
The installation of the MySQL is used in a college enrollment system, a client server system I have developed using VB.Net and MySQL. I can only do the update at night because i know no one is connected to the database.

you can dump the mysql.user and mysql.db tables, which contains all the user info, and reimport that as well, to avoid having to recreate all that. i'd also suggest running repairs on the table after you re-import.
alternatively, you could create a listing of grants:
select concat('show grants for ',quote(user),'#',quote(host),';') from mysql.user
this will output a list of sql statements that you can then run to get specific grant statements.
ultimately though, you'll want to check out your specific version information regarding upgrades, to make sure you've considered any version specific compatibility issues.
here is some information for a 4.1 - 5.x upgrade, for example.

Why is the mysql upgrade so braindead? The fact that you need to back up all your data, install MySQL to a different directory, reimport your data -- just to upgrade is ridiculous. There has to be an easier way.

Related

MySQL to Oracle DB Migration

I have a task to Migrate MySQL DB to Oracle (its my requirement) i tried to Migrate using SQL developer as defined in below link.
https://www.packtpub.com/books/content/migrating-mysql-table-using-oracle-sql-developer-15
As the DB is huge, the constraints are not copied properly from MySQL to Oracle, i need to define/alter/add constraints explicitly, which is time consuming (SQL developer migrates data 300rec/min from mysql to Oracle) & the entire procedure, views, functions is need to re write.
How can i ensure that data has migrated properly or not.?
Is this is a right approach to migrate?
Should i move to any tool which helps to Migrate? If yes please suggest the tool..!!
Or it is the right thing to Move from MySQL to Oracle.
Thanks in Advance.
No specific answer, but some genaral thoughts based on my experiences with migration.
I've found that there normally isn't one tool that does the whole migration job well, and by whole job I mean:
Fast
Handles all data types, scenarios
And that is from Oracle to Oracle!!
Last project we tried Oracle Golden Gate, and found there were issues with that.
We always end up with a hybrid approach, somethings like:
Extract all DDL manually and pre-create objects - there are weaknesses in the stagndard tools that confound them when extracting DDL, e.g. we found 10g expdp did not handle some quirky PLSQL well, so we resorted to extracting this ourselves.
Some tables work well with SQL Loader, others with GG, others (rare) with a custom extract and load process. We had over 3,500 tables and identified about 100 that worked better done as SQLLoader rather than GG. When I say better I mean with data handling and speed of migration. We created different groups of processing each group having a different method.
Once we have an overall hybrid scheme that works, we tune, mainly by splitting that task into parallel processes, both the export and import side.
All my migrations have been big projects where we have shifted from one Oracle system/server to another, always with the target being a newer version of OS and Oracle.
So, I would imagine that migration between non-Oracle and Oracle will through up even more challenges, and probably not as trivial as imply clicking a few buttons in SQL*Developer.
You may find the expected content from the SQL developer documentation at the Oracle website.
There are migration information available for all Microsoft Access users, MySQL users, Microsoft SQL Server and Sybase Adaptive Server users.
You can also download the tutorial in forms of PDF (best for offline viewing and printing), ePub (best for most mobile devices) and Mobi (best for Amazon Kindle devices).
Recently, I have successfully migrated the MySQL database to Oracle database. Below are detail steps:
Operating System: Desktop Ubuntu local and Desktop Ubuntu on amazon aws
Please Note: Here I am using aws desktop ubuntu server because my mysql
database was pretty big. In my case there were 800 tables, 200 views,
procedures, triggers, and functions. The total size of the database was almost
20GB. In case of small database I would recommend to use local ubuntu server.
Tools Used: SQL Developer, VNCServer, Remote Desktop Client, JAVA 8, Third Party MySql JDBC Driver
1. Setup ec2 ubuntu desktop server : https://www.youtube.com/watch?v=ljvgwmJCUjw
2. Install SQL Developer on #1
Download the SQL Developer package from this link :
http://www.oracle.com/technetwork/developer-tools/sql-developer/downloads/index.html
Accept the license agreement and download "Other Platforms" for ubuntu.
Install the SQL developer package as the following.
sudo apt-get install sqldeveloper-package debhelper openjdk-7-jdk
openjdk-7-jre icedtea-7-plugin
Now all that you need to do is to run the command (you might have a
different version)
make-sqldeveloper-package sqldeveloper-4.1.3.20.78-no-jre.zip
This will generate a debian package that you can use to install SQL developer.
Now install the resulting .deb package using the command (Your deb
might have a different version too)
sudo dpkg -i sqldeveloper_4.1.3.20.78+0.2.4-1_all.deb
In my case, I have used java 8.
3. Once you have done with your SQL developer installation on your newly created ec2 instance with VNCServer then all you need to do is to connect to that ec2 instance with the Remote Desktop Client by default available in your ubuntu local machine.
Use IP:1 with user/pass setup for VNCServer in #1
You can see the remote ec2 ubuntu desktop server. You have to grab the keyboard inputs from the Remote Desktop tool if you want to tab inside the remote server.
Once you get connected with the remote client, open SQL Developer from the terminal or from the explorer.
sqldeveloper
Follow the migration steps provided by Oracle corporation:
http://www.oracle.com/technetwork/database/migration/mysql-093223.html
Please Note: While following the migration steps provided by the
oracle they will ask for the destination database connection i.e. oracle
database connection. This is not the database where your MySQL
database will be migrated. Instead, this database connection will
be used for the migration process. Your database connection user
must have user and database create privileges. Once your connection
have user create privilege, then migration process automatically create
the corresponding database user in Oracle database[if you have mysql_test_db in MySQL
database, same mysql_test_db will be created in Oracle db too].
I recently used sqline's tool http://www.sqlines.com/cmd to convert a dump from mysql in the form of an .sql script to an (almost) Oracle-compatible sql script.
sqlines31113\sqlines.exe -s=mysql -t=oracle "-in=$infile"
I just had to (semi-manually) fix some things in the output and then I could run it on my oracle database.

mySQL tables get dropped un-intentionally

In a development environment, where Ubuntu 14.04 installed and updated to Kubuntu 14.04 is used the operating system. MySQL installed and used with Netbeans and JPA using eclipselink. I noted that some tables are dropped without my knowledge and then I created users with no drop or delete privileges. When I log with mysql command, I can not delete tables. But tables are still get dropped intermittently ? What can be the cause? I am really worried as a very similar environment is used in production and a loss of a table can lead severe consequences.
Table just don't magically disappear.
If I was you, I'd start by getting the list of users having the rights to do the delete/drop table.
Ask them if anyone is working on the DDL.
If no one seems to be "guilty", then what about to check what logging possibilities are provided by your DBMS, and to what extent could you log drop operations.

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).

Tool for editing MySQL table permissions?

Is there a tool that makes the task of editing user privileges easier on a MySQL database? I've got nearly 100 tables to work through for 4 users, each with different per-table grants, which is getting tedious via phpMyAdmin. It'll get a lot more irritating when I make changes to the database structure and user list later on. I also can't see a way to do it in MySQL Workbench.
Are there any permissions management tools that make management of table permissions easier?
Update: For clarification, I need a tool that can manage the per-schema and per-table permissions for a user. I'll be changing permissions later, so it needs to be able to fully manage existing permissions as well as grant new ones. MySQL Workbench allows management of per-schema privileges, but not per-table.
Mysql gui tools . See here http://dev.mysql.com/downloads/gui-tools/5.0.html
MySQL Administrator allows you to do all that.
I realize the question is a couple of years old but I came across it while looking for a solution so I suppose others might as well.
I came across SQL Yog and find it capable of doing all that I wanted. I use the community version so it is free to download and its User Manager has the capability to set permissions at the schema and table level.
Workbench is supposed to let you manage users and grant privileges -- see here. You can also use Navicat (not free) or if you are on a mac, Sequel Pro, which is free.
MySQL Workbench provides this functionality.
Open a connection via 'Server Administration'
Click on 'Users and Privileges'
Select the 'Schema Privilegs' tab
Create entries for the schema you're working on, per your needs.
More information here.
Just looked at my install of Squirrel-SQL here. I've only got Oracle databases in this copy of it, but I use it for MySQL at home. Anyway, for Oracle, for tables, it has two tabs: Privileges, and Column Privileges. It may or may not provide similar functionality for MySQL. Give it a look perhaps. (I like it for other database work.)
Try Security Manager tool in dbForge Studio for MySQL (the Security Manager is available in free Express Edition).
In new version multi-user editing is supported; you can select some users and grant or revoke Global and Object (database, tables, fields, ...) privileges, then apply changes or view them in SQL script.
You may want to look at www.securich.com - its an open source user management tool for MySQL.
phpMyAdmin allows table-level privileges. More details can be found, for exemple, here and here.

Offline tool to work with MySQL databases like phpMyAdmin?

Like phpMyAdmin has to be installed as a web application to work with MySQL databases, is there a downloadable program that can connect to a remote MySQL server to create, read, update and delete databases, tables, columns and rows?
My favourite is HeidiSQL, a fork of the late and great mySQLFront.
MySQL GUI tools are great. Here They are doing an EOL but rolling them into a new product.
For Windows, you can use MySQL Query Browser and MySQL Administrator. Download them in one package from:
MySQL GUI Tools