Mainly used the idea from:
http://blog.palominolabs.com/2011/10/03/embedded-mysql-on-java-with-connectormxj-and-64-bit-linux/
And
https://github.com/airlift/testing-mysql-server
The idea is to use mysql-connector-mxj, but the development has been discontinued. Therefore the newest version that came with it is Mysql 5.5.9. That's included in mysql-connector-mxj-db-files.
That's too old and I want to use a newer version: 5.7.5.
The goal here is therefore to build the new mysql-connector-mxj-db-files jar file to include the new Mysql version.
Here is what I did:
1. Download the newer version MySQL to: ~/Downloads/mysql-5-7-5/mysql-5.7.5-m15-linux-glibc2.5-x86_64
2. Run the command:
bin/mysql_install_db --insecure --user=mysql --datadir=/tmp/dbfiles/5-7-5/data --lc-messages-dir=./share/
cd /tmp/dbfiles/5-7-5/data
jar -cf ../data_dir.jar *
This step generates the data folder to /tmp/dbfiles/5-7-5/data. Then I create the data_dir.jar file. The data_dir.jar file should be included in the mysql-connector-mxj-db-files jar.
Another command to run:
jar -cf /tmp/dbfiles/5-7-5/share_dir.jar share/
The share_dir.jar should also be included in the mysql-connector-mxj-db-files jar.
3. Create the mysql-connector-mxj-db-files.jar with newer MySQL version.
Unzip the original mysql-connector-mxj-db-files.jar file. Copy the mysql, mysqld file, data_dir.jar, share_dir.jar to appropriate locations.
Run another jar -cf bla bla command to create the final mysql-connector-mxj-db-files.jar.
Showing posts with label MySQL. Show all posts
Showing posts with label MySQL. Show all posts
7/15/2016
7/13/2016
MySQL commonly used commands
Remote access:
In order to connect remotely you have to have MySQL bind port: 3306 to your machines IP in my.cnf. Then you have to have created the user in both localhost and '%' wildcard and grant permissions on all DB's as such . See below:
In order to connect remotely you have to have MySQL bind port: 3306 to your machines IP in my.cnf. Then you have to have created the user in both localhost and '%' wildcard and grant permissions on all DB's as such . See below:
my.cnf
#Replace xxx with your IP Address
bind-address = xxx.xxx.xxx.xxx
then
CREATE USER 'myuser'@'localhost' IDENTIFIED BY 'mypass';
CREATE USER 'myuser'@'%' IDENTIFIED BY 'mypass';
Then
GRANT ALL ON *.* TO 'myuser'@'localhost';
GRANT ALL ON *.* TO 'myuser'@'%';
Depending on your OS you may have to open port 3306 to allow remote connections.
Specific to Amazon EC2:- The bind-address should be: 0.0.0.0
- Your machine ip address should be added to amazon security group.
Subscribe to:
Posts (Atom)