Oracle VM VirtualBox Manager
to install linux ubuntu, go and download iso files : https://www.ubuntu.com/download/desktop/thank-you?country=GB&version=18.04.1&architecture=amd64
- 1 Internet Connection on VM
- 2 to remote access
- 3 mysql
- 4 replication mysql
Internet Connection on VM
I was having the same problem on Ubuntu 12.10 64bit using Virtualbox 4.2.22. Here are the steps I took to solve my problem:
Open Virtualbox Manager
- Select the machine you cannot get internet on in the left pane
- Click the Settings button in the top menu
- Click Network in the left pane in the settings window
- Switched to Bridged Adapter in the Attached to drop-down menu
- Select the name of the network adapter you are currently using on your host machine. I am using wireless so I chose eth0 which is my wireless network adapter. You can check which adapter you are currently using by opening the terminal (CTRL+ALT+T by default) and running ifconfig. It will probably be the eth adapter that shows an inet addr and shows data transfer next to RX bytes.
- Under Advanced, make sure the machine is using the Desktop Adapter Type
- Under Advanced, make sure Promiscuous Mode is set to Allow VMs
- Under Advanced, make sure Cable connected is checked on
- Hit OK to save your changes
- Start your VM
to remote access
remove OpenSSH: Code:
sudo apt-get remove openssh-client openssh-server
install OpenSSH again: Code:
sudo apt-get install openssh-client openssh-server
The reason is that recent Ubuntu installation (maybe others also), mysql is using by default the UNIX auth_socket plugin.
Basically means that: db_users using it, will be "auth" by the system user credentias. You can see if your root user is set up like this by doing the following:
$ sudo mysql -u root # I had to use "sudo" since is new installation mysql> USE mysql; mysql> SELECT User, Host, plugin FROM mysql.user; +------------------+-----------------------+ | User | plugin | +------------------+-----------------------+ | root | auth_socket | | mysql.sys | mysql_native_password | | debian-sys-maint | mysql_native_password | +------------------+-----------------------+
As you can see in the query, the root user is using the auth_socket plugin
There are 2 ways to solve this:
- You can set the root user to use the mysql_native_password plugin
- You can create a new db_user with you system_user (recommended)
$ sudo mysql -u root # I had to use "sudo" since is new installation mysql> USE mysql; mysql> UPDATE user SET plugin='mysql_native_password' WHERE User='root'; mysql> FLUSH PRIVILEGES; mysql> exit; $ service mysql restart
Option 2: (replace YOUR_SYSTEM_USER with the username you have)
$ sudo mysql -u root # I had to use "sudo" since is new installation mysql> USE mysql; mysql> CREATE USER 'YOUR_SYSTEM_USER'@'localhost' IDENTIFIED BY ''; mysql> GRANT ALL PRIVILEGES ON *.* TO 'YOUR_SYSTEM_USER'@'localhost'; mysql> UPDATE user SET plugin='auth_socket' WHERE User='YOUR_SYSTEM_USER'; mysql> FLUSH PRIVILEGES; mysql> exit; $ service mysql restart
Remember that if you use option #2 you'll have to connect to mysql as your system username (mysql -u YOUR_SYSTEM_USER)
Note: On some systems (e.g., Debian stretch) 'auth_socket' plugin is called 'unix_socket', so the corresponding SQL command should be: UPDATE user SET plugin='unix_socket' WHERE User='YOUR_SYSTEM_USER';
error: mysqld_safe Directory '/var/run/mysqld' for UNIX socket file don't exists.
sudo mkdir -p /var/run/mysqld sudo chown mysql:mysql /var/run/mysqld
MySql case sensitive table names issue on Windows/MacOS to Linux
/etc/mysql/my.cnf file (add the row lower_case_table_names=1)
- lower_case_table_names=0 > table names are stored as specified and comparisons are case sensitive.
- lower_case_table_names=1 > table names are stored in lowercase on disk and comparisons are not case sensitive.
- lower_case_table_names=2 > table names are stored as given but compared in lowercase.
[mysqld] lower_case_table_names = 1
to install vim editor
sudo apt install vim
How to fix master and slave have equal MySQL server UUIDs MySQL Error
if you get error on slave database like below
# mysql -u root -p #mysql> show slave status; Last_IO_Error: Fatal error: The slave I/O thread stops because master and slave have equal MySQL server UUIDs; these UUIDs must be different for replication to work.
Problem : Server UUIDs is automatically generated but it was copied when I cloned mysql instance using AWS AMI
ubuntu@ip-172-31-26-201:/var/lib/mysql$ cat /var/lib/mysql/auto.cnf [auto] server-uuid=fea4e713-9552-11e6-a093-06a1a5e379d3
It can be simply fixed by removing that auto generated auto.conf file and restart MySQL server.
Enjoy your MySQL Master-Slave replication!!!