Linux Commands for Java & MySQL Setup
1. Java Install
First, update the package index.
sudo apt-get update
Next, install Java. Specifically, this command will install the Java Runtime Environment (JRE).
sudo apt-get install default-jre
The JDK does contain the JRE, so there are no disadvantages if you install the JDK instead of the JRE, except for the larger file size.
You can install the JDK with the following command:
sudo apt-get install default-jdk
2. Install MySQL
Step 1 — Installing MySQL Base
On Ubuntu 16.04, only the latest version of MySQL is included in the APT package repository by default. At the time of writing, that's MySQL 5.7
To install it, simply update the package index on your server and install the default package with apt-get.
sudo apt-get update
sudo apt-get install mysql-server
Step 2 —Run the security script and Configure.
Step 3 — Testing MySQL
Regardless of how you installed it, MySQL should have started running automatically. To test this, check its status.
systemctl status mysql.service
3. Extract tar/zip
Type man tar for more information, but this command should do the trick:
To explain a little further, tar collected all the files into one package, community_images.tar. The gzip program applied compression, hence the gz extension. So the command does a couple things:
f: this must be the last flag of the command, and the tar file must be immediately after. It tells tar the name and path of the compressed file.
z: tells tar to decompress the archive using gzip
x: tar can collect files or extract them. x does the latter.
v: makes tar talk a lot. Verbose output shows you all the files being extracted.
4. Folder Permission
In that chmod -R 755 will set these permissions to all files and subfolders in the tree
To change all the directories to 755 (drwxr-xr-x):
To change all the files to 644 (-rw-r--r--):
5. Change User in Linux
How about using the su command?
If you want to log in as root, there's no need to specify username:
6. MySQL Login
The options above means:
7. Reinstall MySQL
Find and remove All Files my.cnf
Try running the following command to reset and purge all MySQL related things:
Once this is done, run the below to update your system and "clean up" your package cache.
Then, try re-installing MySQL Server:
8. MySQL/MariaDB Status
Secure Installation Permission
10. CHAR CODE SET - utf8mb4