mysql_upgrade and MySQL service - Vicious Circle - mysql

I am upgrading MySQL server 5.067 to 5.5.60 on Windows 10.
I stopped the service, replaced bin a shared directory and started the service.
Service start failed with the message (in Event Viewer):
Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
For more information, see Help and Support Center at http://www.mysql.com.
OK, so I opened cmd as admin with the command:
mysql_upgrade --port 64202
With result:
Looking for 'mysql.exe' as: C:\Program Files (x86)\XXX\MySQLServer\bin\mysql.exe
Looking for 'mysqlcheck.exe' as: C:\Program Files (x86)\XXX\MySQLServer\bin\mysqlcheck.exe
Error: Failed while fetching Server version! Could be due to unauthorized access.
FATAL ERROR: Upgrade failed
The design of MySQL upgrade is connecting over TCP to MySQL to run the upgrade, but how it can possibly work if the service is not running? It is a vicious circle - MySQL service needs to be upgraded to be able to start and mysql_upgrade needs to connect to running service.
What is wrong?

Skipping major versions (5.1) is not supported, and may or may not work. The appropriate upgrade is one of:
Plan A: Upgrade to 5.1, then to 5.5. Run mysql_upgrade at each step.
Plan B: Dump the data from 5.0 with mysqldump. (Be sure to get routines, etc). Blow away (or bypass) 5.0 and install a fresh 5.5. Load the data back in. There may be syntax errors in the dump file, edit the file if needed.

Since you're upgrading from 5.0 to 5.5, there are configuration values which are deprecated, causing the engine to be unable to start.
Most likely culprit is skip-dbd, as explained on this site.
So: find your MySQL configuration file, comment out the skip-dbd option and restart the MySQL service. Then you can run mysql_upgrade with the appropriate options including authentication.

Related

How to fix a broken MySQL installation?

Installing a PHP application that requires MySQL or MariaDB, I first installed MariaDB via 'apt install' from the MariaDB repos, but there were behaviours with the installation of the application that seemed to be caused by some kind of incompatibility. Calls to the DB were timing out, and although I could see it was creating the DB, it was impossible to set the application up in its setup routine.
So I used apt remove to get rid of MariaDB. I saw the application had a *.deb installer for all requirements (wish I'd seen this sooner!) and, after removing PHP and Nginx, I attempted to install it the normal way. Unfortunately, the MySQL portion of the installation failed with:
Automatic maintenance of MySQL Server daemon disabled.
Packaging maintainer scripts detected a case that it does not know how to handle and cannot continue configuring MySQL. Automatic management of your MySQL Installation has been disabled to allow other packaging tasks to complete. For more details, see /etc/mysql/FROZEN
Unfortunately, /etc/mysql/FROZEN is a symlink to a non-existent file explaining downgrading. I can't run the uninstaller of the overall package or repair the installation with sudo --fix-broken install because the installer requires a MySQL password I can't provide it.
How can I fix my borked MySQL installation? If I could just get to a place to have MySQL run properly, understanding what left-overs perhaps from the MariaDB installation that I need to delete manually before trying to repair it, that would be helpful. FYI, the version of MariaDB was 10.3, and the version of MySQL the application package was installing was 5.7.
Any suggestions appreciated.

Errors with MySQL 5.7 installation on Mac OS X El Capitan

I need some help here to understand installing and initializing MySQL on my local Macbook. First I have installed MySQL using the DMG file and everything looks like it worked fine. I even tried doing some basic hello-world type of activities on the database to get a feel of it.
Then next I came across this page in the documentation that explained the process of initializing the data directory. I got really puzzled, and just decided to uninstall MySQL following the instructions here and go through the whole installation process again. My goal for doing so was so that I could follow the initialization instructions as stated in the documentation before I started using the database, unlike in the first time round, where I started using it before I had initialized.
I found the process of initialization to be quite tricky and confusing. As I was at the step running the command
shell> bin/mysqld --initialize --user=mysql
the errors popped up
2016-01-17T17:28:21.145457Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2016-01-17T17:28:21.162124Z 0 [ERROR] --initialize specified but the data directory has files in it. Aborting.
2016-01-17T17:28:21.162188Z 0 [ERROR] Aborting
and then I another part of the documentation entitled Initializing the Data Directory Manually Using mysql, that accounted for this error and actually said:
If a data directory exists and is not empty (that is, it contains files or >subdirectories), the server exits after producing an error message:
[ERROR] --initialize specified but the data directory exists. Aborting.
In this case, remove or rename the data directory and try again.
As of MySQL 5.7.11, an existing data directory is permitted to be nonempty >if every entry either has a name that begins with a period (.) or is named >using an --ignore-db-dir option.
So that was what I did and I could proceed with the initialization. After that I continued with starting up the server normally,
After you initialize the data directory by starting the server with -->initialize or --initialize-insecure, start the server normally (that is, >without either of those options) and assign the 'root'#'localhost' account >a new password:
a sequence of steps I shall not quote here
and finished up the rest of the instructions in the docs, and then shutting down the server.
But I realized then the dedicated MySQL pane in the System Preferences of my Mac, which shows whether or not MySQL server is running or not, still showed that MySQL Server Instance was still running. It reminded me of the possibility that I perhaps I did not do enough to have removed the MySQL pane from System Preferences, and what I was seeing was a ghost from my first installation. I wanted to eliminate that, so I went through the whole process, uninstalling and the installing from DMG and initializing MySQL again. But this time, when I try running the server, I get a new error :
Kohs-MacBook-Pro:mysql Kohaugustine$ sudo bin/mysqld_safe --user=mysql &
[2] 15041
Kohs-MacBook-Pro:mysql Kohaugustine$ 160117 11:52:56 mysqld_safe Logging to '/usr/local/mysql-5.7.10-osx10.9-x86_64/data/Kohs-MacBook-Pro.local.err'.
160117 11:52:56 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql-5.7.10-osx10.9-x86_64/data
160117 11:52:58 mysqld_safe mysqld from pid file /usr/local/mysql-5.7.10-osx10.9-x86_64/data/Kohs-MacBook-Pro.local.pid ended
And right now, MySQL server just refuses to startup, no matter how many times I try. Not even when I do it using the GUI through the System Preferences, clicking on Start MySQL Server icon has literally no effect.
I don't know what to do right now, and would greatly appreciate any help on this!
All this just really puzzles me, and I also have the following questions for which any answers on will be of great help:
Why was the data directory already created upon the automated installation from the DMG file? Did the DMG installation also do an initialization already? In that case, then why does the docs still tell us to initialize our installation?
Is the method of uninstalling MySQL that I followed from the instructions I have posted above correct? Does this procedure of uninstallation actually remove MySQL pane from System Preferences?
Its been pretty frustrating trying to install MySQL, but perhaps this has to do with my overall inexperience with databases in general.
Thank you very much.
MySQL could be shutting down because of a permissions issue with your data directory. I just ran into that problem yesterday. Try the following command:
sudo chown -R mysql /usr/local/mysql-5.7.10-osx10.9-x86_64/data
This will change the owner of the data directory to match the user that you're using to run the MySQL daemon. For what it's worth, on my Macbook (Yosemite, MySQL 5.5), the user is "_mysql" instead of "mysql". So you should double-check that.
As for your other questions...
I believe the data directory comes as part of the MySQL package that you download. MySQL keeps information about itself in several MySQL databases. Those databases should be in the data directory when you do a fresh install.
I haven't tried uninstalling MySQL yet, but the steps look like they should work. Specifically, the line about removing files from the PreferencePanes folder should remove the MySQL pane from System Preferences (following a reboot). The bits containing:
sudo rm -rf .../my*
make me a little uneasy though.
Do you have any *nix experience? I think that would help you more than familiarity with databases in this particular case, as you're going under the bright candy shell of OS X and getting into the dark, chocolaty center that is BSD Unix.
Hope this helps. Good luck!

Error 2003 (HY000): Can't connect to MySQL server on 'localhost' (10061)

Please don't post this question as duplicate. I am trying to configure mysql for about 3 weeks now. Someone should really help me.
I recently installed MySQL 5.1 in a Lenovo laptop to do my project. The laptop is running on Windows 8.
The installation was fine but when I tried to configure MySQL it worked till the last page.
There am getting Error Nr 2003.
I tried it through the command prompt, through services in the control panel. But the problem is that the mysql service is not starting at all. Why it is not starting ? What will be blocking it from starting ?
First you need to start mysql service it is the problem for this above
error.
In case you cant start mysql service means you need to install mysql service.
Steps for install mysql service
Step 1: open command prompt and go to the mysql installed location (for example c:\Program Fiels\MYSQL\Mysql Server5.0\bin\)
Step 2: mysql --install
Step 3: start mysql service using the command NET START MYSQL command
then connect mysql using username and password.
Assuming the service is already running and you still get this error connecting to the localhost using the mysql client, then make sure you have an entry for "localhost" in your hosts file. This was the case I experienced.
I resolved this situation following the following process. After adding the MySQL path to the environment, I kept invoking the program and then checking Event Viewer in the Application Log for MySQL errors that referenced old commands in the ini file. After removing them, what was hanging me up was that the installer was looking for errmsg.sys in a folder that didn't exist, \bin\share. Those folders DO exist, but on the same level, not nested. So I added the folder share to bin and copied errmsg.sys from share to the new nested share, and it worked.
Now that its running, I intend to redo a proper configuration using the workbench, just to gets my ducks in a row.
hth
Go to Run type services.msc. Check whether MySQL services is running or not. If not, start it manually. Once it started, type mysqlshow to test the service.

Installing mysql noinstall zip archive

I've been trying to use my mysql noinstall zip archive and the steps that I found in some of the websites are not descriptive. Can someone help?
If you follow the instruction here you will be alright. From that page:
Users who are installing from the noinstall package can use the instructions in this section to manually install MySQL. The process for installing MySQL from a Zip archive is as follows:
Extract the archive to the desired install directory
Create an option file
Choose a MySQL server type
Start the MySQL server
Secure the default user accounts
To start the sever run
mysqld --console
and after that run
mysql -u root
to start doing whatever you want.
Notice that MySql will function exactly the same as if you would have installed or configured it to run as a service. Your schema's are stored on disk. If you start it after you've stopped it your previous data will still be there. So it doesn't turn magically into an in-memory database.
If you want to install the MySQL database as a service you can use the command below.
mysqld.exe --install

Mysqld Crashes immediately on running on Windows 7...?

I am trying to run MySql 5.1 on Windows 7 Home Premium 64 bit. I have downloaded the MSI installer from the MYSql website and installed it. The installation is successful, but the service does not start.
If I try to run MySql manually using the mysqld executable, it crashes immediately on running (error: mysqld.exe has stopped working).
Earlier mysql was running on the machine, but I had some problem with it (wasn't executing big queries) and installed it again which somehow broke the program. I had installed it to work as a service which started giving me this isse, and now it won't work even if I don't install it as a service.
I have tried removing the mysql folder and re-installing. Is there somewhere else where Mysql saves configuration info or other data?
Has anyone else found this problem and solved it?
How can I find out why the process is failing to run?
Or you can try and run the mysqld.exe as administrator.
See the Debugging a MySQL Server in your MySQL reference manual.
download the noinstall (zip archive) version of MySQL corresponding exactly to the version that is already installed on your system
extract the .pdb symbols files to your existing MySQL installation's bin directory
start Dr. Watson
start mysqld-debug in standalone mode
capture the list of all moduled (i.e. loaded DLLs) with their full path from DrWatson
capture the stack trace from DrWatson
examine the MySQL log files (including mysqld.trace) to see what went on immediately prior to the crash