Recently I've started to setup a Development environment at home that would have some technologies for my next project - Spring MAVEN with JPA and running on JBOSS connected to MYSQL and using IntelliJ IDE for development.
During this setup process, I had to go through install and reinstall process of MYSQL and a lot of online googling to find answers on how. Unfortunately, there weren't a lot of guides out on the internet helped me (although the instructions from digital ocean were pretty good) in a comprehensive/complete way.
A lot of the setup install/re-install steps were scattered over several articles, stack exchange, stack overflow, askubuntu resources. So, I started to document this process myself and this is what I came up with.
To start, I am just setting up MYSQL for root user, which would be the case since this Development rig is only for my home setup and is not meant for any production environment. The elevated access of root also makes it easier for setting up other stuff that I need for my project.
First step is to sudo as root together with the root user's environment:
sudo -i
Once logged in as root, you need to install mysql:
sudo apt-get install mysql-server mysql-client mysql-common dbconfig-mysql
If you have a previous mysql installation, you need to remove all instances of mysql:
1. Backup any my.cnf fiels you have and copy to your personal folder:
cp my.cnf /home/users/someacct/Documents/my.cnf.bak
2. Remove mysql folder:
rm -rf /etc/mysql
2. Remove mysql:
sudo apt-get remove --purge mysql-common mysql-client mysql-server dbconfig-mysql
3. Remove packages and dependencies of mysql:
sudo apt-get autoremove
sudo apt-get autoclean
After installing mysql, install mysql-workbench (mysql GUI tool):
sudo apt-get install mysql-workbench
Next run the mysql_secure_installation script to address security concerns in a default mysql installtion:
sudo mysql_secure_installation
The previous script will go through a wizard that would ask about permissions related to root, allowing you to change the root password and if mysql can be accessed outside localhost.
Now, test your mysql installation with root:
mysql -u root -p
This would take you to the mysql prompt where you can begin to to use mysql, you can test it by running the command:
show databases;
This should show all the default databases (including mysql) that comes with your installation.
In my next post, I will go through the steps that I went through to setup mysql for remote access.
No comments:
Post a Comment