mysql upgrade (5.0.45 to 5.1.42) error - mysql

I am getting following error when we are upgrading 5.0.45 to 5.1.42. Do I need to use mysql_upgrade
or mysqlcheck ?
Caused by: java.sql.SQLException: Column count of mysql.proc is wrong. Expected 20, found 16. Created with MySQL 50045, now running 50142. Please use mysql_upgrade to fix this error.
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1055)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3515)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3447)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1951)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2101)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2554)
at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1761)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2046)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1964)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1949)
at org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:102)
at org.springframework.jdbc.core.JdbcTemplate$2.doInPreparedStatement(JdbcTemplate.java:792)
at org.springframework.jdbc.core.JdbcTemplate$2.doInPreparedStatement(JdbcTemplate.java:1)
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:586)

If you're running on a XAMPP setup on ubuntu, navigate to:
/opt/lampp/bin
Then run
./mysql_upgrade
It should run a check through all your existing databases, at the end it may give you this error message:
Could not create the upgrade info file
'/opt/lampp/var/mysql/mysql_upgrade_info' in the MariaDB Servers
datadir, errno: 13
Not to worry, you can now import your db.sql script without errors.
In case you want to access your MariaDB shell, from the same location:
If you haven't set up a password:
./mysql -u root
If you've set up a password:
./mysql -u root -p

in mysql 5.1 4 additional columns were added for procedures. Seems that somehow your upgrade skipped that step and now you are getting error while importing data.
MySQL upgrade should help you solve that problem.

The exception indicates you should use mysql_upgrade.

Related

Maria DB: MySQL Server has gone away, nothing in error log

I'm trying to slurp a database dump into a new database on my server, and I keep getting the following error
ERROR 2006 (HY000) at line 215: MySQL server has gone away
I've tried setting max_allowed_packet=16M in /etc/my.cnf
And editing the command directly: mysql -u my_db_user -p --max_allowed_packet=1073741824 my_db < my_db.sql
I still get this error. It doesn't create an error message in the log file, either. I'm running a mariadb fork of mysql (mysql 15.1, mariadb 5.5.52), CentOs version 7.3.1611.
Not sure what to do at this point!
Try setting max_allowed_packet=2G in my.cnf.

MySQL: All tables OK but still ERROR 1577 (system tables used by Event Scheduler were found damaged)

From my syslog:
mysql[1663]: ERROR 1577 (HY000) at line 1: Cannot proceed because system tables used by Event Scheduler were found damaged at server start
I tried this command to find damaged tables:
mysqlcheck -A --auto-repair --password
but all tables are OK. What's to do now?
EDIT
I also tried
sudo mysql_upgrade -u root -h localhost -p --verbose --force
but everything is OK. Still get the error.
I had the same problem, altough I didn't notice any errors or problems, I got those warnings. They seemed harmless.
I use MariaDB Ver 15.1 Distrib 10.3.22-MariaDB, for debian and your command fixed the issue perfectly:
mysql_upgrade -u root -h localhost -p --verbose --force
After lot of R&D finally i found solution...........
Basically its happen with mysql 5.7.10 version or earlier versions.
I was getting this error with event table(Mysql event scheduler).
solution-
click on start menu => search for Mysql installer => click on upgrade=> upgrade all mysql => it's really work.............!
I use Navicat for structure synchronisation and it's usually hassle-free, but with this problem I wasn't able to correct the base issue on shared hosting. Unticking 'Compare events' under 'Options' on the screen for selection of Source and Target allowed the structure synch to proceed unhindered.

MySQL "#2006 - MySQL server has gone away" in phpMyAdmin

The Problem
My MySQL database works fine for my web application. However, when I try to open the database with phpMyAdmin, I get this error message:
#2006 - MySQL server has gone away
And phpMyAdmin disconnects back to the login screen. Other databases work fine.
My ax_allowed_packet is set to 16. I also tried 64, but it didn't work.
Also this error occured eventually. The database is about 3 MB in size, so not very big.
Used Software
Debian Squeeze x64
MySQL (current version)
phpMyAdmin (current version)
Question
How can I fix this error in order to view and edit my database in phpMyAdmin again?
I finally found it.
Apparently, there were some incompatibility issues after upgrading to MySQL 5.6.
In order to check for such issues and fix them, you will need to do a MySQL Upgrade.
Just run the following on a terminal:
mysql_upgrade -u root -p
Enter your password, and wait until the upgrade finishes.
This fixed the problem for me.
My Reputation is not high enough so i can't comment so i will here, mysql_upgrade -u root -p worked for me i had the same issue, after upgrading mysql, everything worked. i could could log into the database using phpmyadmin but when i tried to add a user it failed , giving MySQL “#2006 - MySQL server has gone away”, Note that i also updated phpmyadmin with yum update phpmyadmin first before running mysql_upgrade -u root -p.
Now all works fine, thanks!

How to disable --skip-grant-tables in MySQL?

I am trying to initialize the database for my OpenGTS installation. However, when I run the shell script that accomplishes this, I get the following error:
Version: 2.4.5
Database created: gts
[ERROR|DBAdmin.execCommands:843] ==> SQLException: DB grant error [jdbc:mysql://localhost:3306/]
[ERROR|DBAdmin.execCommands:843] Message: The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement
[ERROR|DBAdmin.execCommands:843] SQLState: HY000
[ERROR|DBAdmin.execCommands:843] ErrorCode: 1290
[DBAdmin.execCommands:843] java.sql.SQLException: The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement
java.sql.SQLException: The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1055)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3558)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3490)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1959)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2109)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2642)
at com.mysql.jdbc.StatementImpl.executeUpdate(StatementImpl.java:1647)
at com.mysql.jdbc.StatementImpl.executeUpdate(StatementImpl.java:1566)
at org.opengts.dbtools.DBConnection._executeUpdate(DBConnection.java:961)
at org.opengts.dbtools.DBConnection.executeUpdate(DBConnection.java:908)
at org.opengts.dbtools.DBConnection.executeUpdate(DBConnection.java:889)
at org.opengts.dbtools.DBProvider.grantDBUser(DBProvider.java:2132)
at org.opengts.dbtools.DBAdmin.execCommands(DBAdmin.java:841)
at org.opengts.db.DBConfig._main(DBConfig.java:1246)
at org.opengts.db.DBConfig.main(DBConfig.java:1361)
I think it's pretty clear that I need to disable --skip-grant-tables, but I am new to MySQL and SQL in general. Recently, I followed a tutorial to reset the MySQL root password and I believe I enabled --skip-grant-tables through that. I've tried looking for solutions to disable this, but haven't come across anything.
Anyone able to help?
Just type: mysqladmin shutdown and then start MySQL service by running command: service mysql start.
:-)
Check your my.cnf file, you probably added that option in there.
Try this:
sudo systemctl set-environment MYSQLD_OPTS=""
(It worked for me.)
you must have stopped the server and run this
mysqld_safe --skip-grant-tables due to root pwd chg
so stop the server and start it normal with a start

use database is giving the error message

mysql> show databases;
ERROR 1018 (HY000): Can't read dir of '.' (errno: 13)
I have installed the mysql-server using
apt-get install mysql-server as root.
If I issue command to use other database than mysql it is working properly
mysql> use mysql;
ERROR 1049 (42000): Unknown database 'mysql'
what the issue please help.
To fix this, I added open-files-limit = 2048 to the [mysqld] context in /etc/mysql/my.cnf
Restarted mysql and all came good.
Check: http://i-learnings.blogspot.com.au/2012/11/error-1018-hy000-cant-read-dir-of-errno.html
MySQL may be installed, but no database inside (altough it'd be weird).
Try to issue mysql_install_db.
PATH_TO_MYSQL/scripts/mysql_install_db --user=mysql
Check this out: http://dev.mysql.com/doc/refman/5.1/en/unix-postinstallation.html
You should check your datadir. To find out where MySQL stores data:
SHOW VARIABLES LIKE 'datadir';
Check that directory. It should be owned by mysql.mysql, same for all directories below. Privileges should be drwx------.
Maybe it is caused by this bug. http://bugs.mysql.com/bug.php?id=15851
The suggested fix is to update the directory permissions.