Data not available after restart mysql [closed] - mysql

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 3 years ago.
Improve this question
I have a DB dump which has been exported from PHPMyAdmin and I sourced it using the terminal to MySQL.
source file/path/file.sql
All tables and data created but after exit and enter again to MySQL console, the MySQL all the data has been lost only the table structure is there.
exit
mysql -u user -p
I’ve tried on several times but same happened then I completely uninstalled and install MySQL again, but the result was same.
What may be the reason for this? How to fix this issue?

Maybe the Commit; Statement can help you.
But please help us first by showing us some code. Then we maybe able to help you more efficiently.
See link for more Information on Commit:
https://www.studytonight.com/dbms/tcl-command.php
To give you the essential points from the link:
COMMIT command is used to permanently save any transaction into the database.
When we use any DML command like INSERT, UPDATE or DELETE, the changes made by these commands are not permanent, until the current session is closed, the changes made by these commands can be rolled back.
To avoid that, we use the COMMIT command to mark the changes as permanent.
The code is realy simple, make all you changes and then use:
Commit;
Thats all. Just remember that you can rollback at a maximum 1 commit ;)
-> So changes become permanent after the second "Commit"

Related

Mysql, all the data is deleted as i closed my workbench [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 1 year ago.
Improve this question
So I am having this problem where I enter data in MySQL table everything works fine it stored in the table and when I read it with the select command it perfectly works but when I close my workbench my all the entries are removed only the null table is there
The most common mistake would be that you are not committing the data. Workbeanch opens a connection that isolates you from the rest of the DB and all your changes are visible only to yourself. When you close the Client (without committing) you end up making a ROLLBACK.
Call COMMIT; see here or click the respective button in the client.
If you do not want to write the command you can use the appropriate buttons:
Find out more here

How to automate update process between 2 databases [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I'm quite new to mysql and in database management in general....
I've to solve this scenario:
In the development stage the web site has the database in the local machine and some tables are dedicated to contain information data used by the application ,during the development the records of that tables grow and when we move to production we want to update the production server with the new data...
Can someone advise the best practice to automate the update process from the local to the production database.
Thanks in advance
The road to doing this successfully is to have each database know how far it has migrated.
You should absolute use something like Liquibase or Flyway to do it. If you have a simple database environment these two will work. Both of these will track changes in version files that the database keep track of.
If you need more complexity, like in a sharded environment, you probably need to roll your own tool for this.
You should mention different .sql files for each environment like,
development.sql,
staging.sql,
production.sql
And you need to write shellscript to execute this script while deployment process.
Also, you need to maintain one constant to get current environment.

Backup MySQL DB with SVN? [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I have a MySQL DB which should be versioned with SVN. I dont want the full DB, only the structure and selected tables. I searched the net and found some information, but nothing seems to really work in a reliable way. Any experience or hints?
Thanks :)
Check out this script which automates the process, allowing for specific selection of databases and exclusion of tables [disclaimer I am the author] - http://mysql-svn-backup.redant.com.au/
Use mysqldump to export the data you want into a file and put this into SVN. Using cron, you can automize this to run in specific timeslots
The question is: what exactly do you want to version, and why?
I propose you version an SQL file that you can import to create your database. Any tool can be used to create this SQL file (basic tool: mysqldump), which you can then save into your SVN repository. You will be able to track new tables being created by comparing revisions of SQL files.
You can automate this process by adding a CRON job to automatically dump and commit the file every 2 hours.

ejabberd mysql script bug? [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
Hihi, not sure if i am just plain dumb.. Have installed ejabberd on amazon ec2 and recently managed to switch to use mysql based on the guide: https://support.process-one.net/doc/display/MESSENGER/Using+ejabberd+with+MySQL+native+driver
I have an issue now after switching to mysql db, not able to add roster to my user, and the log shows that the table rosterusers does not exist.
And now I am confusing, I grabbed the mysql.sql db schema from ejabberd github at https://github.com/processone/ejabberd/blob/master/src/odbc/mysql.sql, and found that
there isn't any rosterusers table to be created, instead, it creates a table called rosteritem.
there isn't any table called rostergroups, but rostergroup (without 's'). After some googling around, i think rostergroups should be the correct naming.
Is there anyone here knows is this a bug in the mysql schema, or i am missing something?
Thanks in advance!
I have not gotten any feedback regarding this question, but eventually, I have manually changed some of the table schema created from the mysql.sql script to matched the one from mssql.sql.
Everything works fine thereafter!
:)

How to recover a MySQL database: Incorrect information in file: './xxx.frm' [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 11 years ago.
The community reviewed whether to reopen this question 5 months ago and left it closed:
Original close reason(s) were not resolved
Improve this question
A very important database has gone corrupt that was sitting on server at a shared web host, and I didn't back up. The table contains a large list of very important email addresses. I can get a table listing, but if I open any of the tables with Navicat or phpMyAdmin, I get the following error:
Incorrect information in file: './the-table-name.frm'
I was able to get a hold of the .frm files associated with the database from the web host.
There is other data in there, but if I could at least get the email addresses, I would be alright.
How do I recover this database?
I would be willing to pay somebody to fix this.
This belongs on serverfault.
First, .FRM files contain none of your "data". They are simply the definition of the table.
If all of the following are true:
The table is using the MyISAM storage engine
You know the CREATE TABLE statement required to recreate the table
Then, do the following:
Stop MySQL
Backup your table_name.frm, table_name.MYI, table_name.MYD files
Delete them from your mysql data directory (/var/lib/mysql usually)
Start MySQL
CREATE the table again
Stop MySQL
Copy the .MYD and .MYI files back into the datadir, replacing the ones there.
Start MySQL
???
Profit
I had a similar issue, it turns out the MySQL InnoDB engine was turned off (I was able to check via phpMyAdmin, a bash pro could tell you how to do it other ways). in my case, it was a simple as restarting MySQL, but you may want to check your config if something changed there.