Install MySQL 5.5 in Ubuntu 11.10 - mysql

I have been downloaded the DEB package of mysql 5.5.23.
Install MySQL by the command as follows:
sudo dpkg -i mysql-5.5.23-debian6.0-x86_64.deb
The result said that installed successfully.
But when I type the command:
sudo service mysql start
Or
mysql
It shows me that "mysql: unrecognized service" or "mysql: command not found".
Besides, I can't find MySQL files in "/usr/include" or "/usr/bin"
Please help me. Thx.

Because MySQL 5.5.x is not packaged, in repositories only exist 5.1.x
This worked for me:
http://www.rebojo.com/debian-installing-mysql/

Why not a simple command :
sudo apt-get install mysql-server

MySQL Download URL
https://dev.mysql.com/get/Downloads/MySQL-5.5/mysql-5.5.56-linux-glibc2.5-x86_64.tar.gz
Open the terminal and follow along:
Uninstall any existing version of MySQL
sudo rm /var/lib/mysql/ -R
Delete the MySQL profile
sudo rm /etc/mysql/ -R
Automatically uninstall mysql
sudo apt-get autoremove mysql* --purge
sudo apt-get remove apparmor
Download version 5.5.51 from MySQL site
wget https://dev.mysql.com/get/Downloads/MySQL-5.5/mysql-5.5.56-linux-glibc2.5-x86_64.tar.gz
Add mysql user group
sudo groupadd mysql
Add mysql (not the current user) to mysql user group
sudo useradd -g mysql mysql
Extract it
sudo tar -xvf mysql-5.5.56-linux-glibc2.5-x86_64.tar.gz
Move it to /usr/local
sudo mv mysql-5.5.56-linux-glibc2.5-x86_64 /usr/local/
Create mysql folder in /usr/local by moving the untarred folder
cd /usr/local
sudo mv mysql-5.5.49-linux2.6-x86_64 mysql
set MySql directory owner and user group
cd mysql
sudo chown -R mysql:mysql *
Install the required lib package (works with 5.6 as well)
sudo apt-get install libaio1
Execute mysql installation script
sudo scripts/mysql_install_db --user=mysql
Set mysql directory owner from outside the mysql directory
sudo chown -R root .
Set data directory owner from inside mysql directory
sudo chown -R mysql data
Copy the mysql configuration file
sudo cp support-files/my-medium.cnf /etc/my.cnf
Start mysql
sudo bin/mysqld_safe --user=mysql &
sudo cp support-files/mysql.server /etc/init.d/mysql.server
Set root user password
sudo bin/mysqladmin -u root password '[your new password]'
Add mysql path to the system
sudo ln -s /usr/local/mysql/bin/mysql /usr/local/bin/mysql
Reboot!
Start mysql server
sudo /etc/init.d/mysql.server start
Stop mysql server
sudo /etc/init.d/mysql.server stop
Check status of mysql
sudo /etc/init.d/mysql.server status
Enable myql on startup
sudo update-rc.d -f mysql.server defaults
*Disable mysql on startup (Optional)
`sudo update-rc.d -f mysql.server remove`
REBOOT!
Now login using below command, start mysql server if it's not running already
mysql -u root -p

Related

Unable to set password error while Mysql Data Migration

I am trying to migrate mysql databases from one server to another. I am following these steps for the migration (270GB of data including databases and users in datadir):
sudo service mysql stop
sudo apt-get purge mysql-server-5.5 mysql-common
sudo rm -rf /var/lib/mysql
sudo rm -rf /etc/mysql
sudo ln -s <path to datadir>/mysql /var/lib/mysql
sudo apt-get clean
sudo apt-get purge mysql*
sudo apt-get update
sudo apt-get install -f
sudo apt-get install mysql-server-5.5
This asks for root password, which I try to set accordingly. However, I am getting the following response:
Configuring mysql-server-5.5
Unable to set password for the MySQL "root" user
An error occurred while setting the password for the MySQL administrative
user. This may have happened because the account already has a password, or
because of a communication problem with the MySQL server.
You should check the account's password after the package installation.
Please read the /usr/share/doc/mysql-server-5.5/README.Debian file for more
information.
Note that I followed the same steps on another ubuntu server (dev) based on the same AMI and was successful in doing the setup. The only variable between the two is data.
I cannot afford much downtime, and therefore using rsync for data replication.
I know that both the ubuntu and mysql versions are old, but this migration is necessary and has strict deadlines.
The solution here was pretty simple.
Rebooting the ubuntu server after following the steps to purge mysql* worked for me. Steps:
sudo service mysql stop
sudo apt-get purge mysql-server-5.5 mysql-common
sudo rm -rf /var/lib/mysql
sudo rm -rf /etc/mysql
sudo ln -s <path to datadir>/mysql /var/lib/mysql
sudo apt-get clean
sudo apt-get purge mysql*
Reboot the ubuntu machine.
Then:
sudo apt-get update
sudo apt-get install -f
sudo apt-get install mysql-server-5.5

[Fail]: Starting MySQL in my Ubuntu docker

FROM ubuntu
RUN apt-get update && \
apt-get -y upgrade && \
apt-get install -y mysql-server && \
apt-get install -y mysql-client
Then, I started a container, and ran:
/etc/init.d/mysql restart
Unfortunately, it didn't work:
root#5e37c0985d07:/opt# /etc/init.d/mysql restart * Stopping MySQL
database server mysqld
[ OK ]
* Starting MySQL database server mysqld
No directory, logging in with HOME=/
[fail]
Please note No directory, logging in with HOME in the error message.
Try usermod -d /var/lib/mysql mysql and then /etc/init.d/mysql restart
Try First to create an empty directory "mysql" at the host machine and then run the container with this directory path bind to the container directory path.
Ex:
docker run -i -t -p "3306:3306" -v ${PWD}/mysql:/var/lib/mysql "docker-image"

In XAMPP MySQL database is not starting

Although if have written some commands in terminal like this:
sudo killall mysql
sudo chmod -Rf 777 /Applications/XAMPP/xamppfiles/var/mysql/
sudo /Applications/XAMPP/xamppfiles/bin/mysql.server start

MySQL 5.7 installation on Mac OS X El Capitan 10.11.4

I am new to Mac OS X El Capitan 10.11.4. I tried installing MySQL 5.7.4 on MAC OS X from .dmg file that contains .pkg file. In the first time installation it prompted a root password (I am not sure if it prompted or I missed) but I missed noticing it.
I again run the MySQL installation but it does not prompted the root user password this time during installation. I tried setting root user password from previous Stack Overflow post but nothing seems to work. Can you explain me process to reset MySQL root user password or to reinstall MySQL so that it prompt the root user password?
I got the solution; here is step-by-step process to reset root password in MySQL:
Stop the mysqld server. This can be done by from 'System Preferences' > MySQL > 'Stop MySQL Server'
Start the server in safe mode with privilege bypass
From a terminal:
sudo /usr/local/mysql/bin/mysqld_safe --skip-grant-tables
In a new terminal window type:
sudo /usr/local/mysql/bin/mysql -u root
UPDATE mysql.user SET authentication_string = PASSWORD('MyNewPass')
WHERE User = 'root' AND Host = 'localhost';
FLUSH PRIVILEGES;
\q
Stop the mysqld server again and restart it in normal mode.
What worked for me was, to uninstall the old 5.7 version (from the pkg installer) that didn't start and/or had issues showing the root password, and install the same version with brew.
1) Remove the remnants of the old installation.
sudo rm /usr/local/mysql
sudo rm -rf /usr/local/mysql*
sudo rm -rf /Library/StartupItems/MySQLCOM
sudo rm -rf /Library/PreferencePanes/My*
rm -rf ~/Library/PreferencePanes/My*
sudo rm -rf /Library/Receipts/mysql*
sudo rm -rf /Library/Receipts/MySQL*
sudo rm -rf /private/var/db/receipts/*mysql*
Use sudo at your own discretion, never copy paste commands from random
people
2) Then proceed to install with brew.
$ brew update
$ brew info mysql#5.7
Expected output: mysql#5.7: stable 5.7.XX (bottled) [keg-only]
$ brew install mysql#5.7
$ echo 'export PATH="/usr/local/opt/mysql#5.7/bin:$PATH"' >> ~/.bash_profile
Because this is keg only, we need to manually put mysql in our PATH
$ mysql.server start
$ mysql.server stop
Use these commands to start/stop mysql
$ mysql_secure_installation
That was what I had to do to make it work.

mysql - installing or upgrading mysql 5.5 to 5.6 in Linux mint

Following error message getting while upgrading from Mysql 5.5 to 5.6.
The following packages have unmet dependencies:
mysql-client-5.6 : Depends: mysql-client-core-5.6 but it is not going to be installed
mysql-server-5.6 : Depends: mysql-server-core-5.6 (=
5.6.19-0ubuntu0.14.04.1) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
I had the same problem which was solved after update and upgrade.
Try this, I hope this works for you:
$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo apt-get install mysql-server-5.6
Installing MySQL 5.6 on Linux(debian based distro):
Uninstall any existing version of MySQL:
sudo apt-get purge mysql-server mysql-client mysql-common mysql-server-core-*
mysql-client-core-*
sudo rm -rf /etc/mysql /var/lib/mysql
sudo apt-get autoremove
sudo apt-get autoclean
Automatically uninstall mysql:
sudo apt-get autoremove mysql* --purge
sudo apt-get remove apparmor
Download version 5.5.51 from MySQL site
wget https://dev.mysql.com/get/Downloads/MySQL-5.5/mysql-5.5.56-linux-glibc2.5-x86_64.tar.gz
Add mysql user group:
sudo groupadd mysql
Add mysql (not the current user) to mysql user group:
sudo useradd -g mysql mysql
Extract mysql-5.6.*-linux2.6-x86_64.tar.gz to /usr/local:
cd /usr/local
sudo tar -xvf mysql-5.6.*-linux2.6-x86_64.tar.gz
Create mysql folder in /usr/local:
sudo mv mysql-5.6.*-linux2.6-x86_64 mysql
Set mysql directory owner and user group:
cd mysql
**sudo chown -R mysql:mysql * **
Install the required lib package:
sudo apt-get install libaio1
Execute mysql installation script:
sudo scripts/mysql_install_db --user=mysql
Set mysql directory owner from outside the mysql directory:
sudo chown -R root .
Set data directory owner from inside mysql directory:
sudo chown -R mysql data
Copy the mysql configuration file :
sudo cp support-files/my-medium.cnf /etc/my.cnf
Start mysql:
sudo bin/mysqld_safe --user=mysql &
sudo cp support-files/mysql.server /etc/init.d/mysql.server
Initialize root user password:
sudo bin/mysqladmin -u root password 'test'
Start mysql server:
sudo /etc/init.d/mysql.server start
Stop mysql server
sudo /etc/init.d/mysql.server stop
Check status of mysql:
sudo /etc/init.d/mysql.server status
Enable myql on startup:
sudo update-rc.d -f mysql.server defaults
Add mysql path to the system:
sudo ln -s /usr/local/mysql/bin/mysql /usr/local/bin/mysql
Now directly use the command below to start mysql
mysql -u root -p