!!

Register new account or login on the forum!

To have a full access of the forum please create a new account! Click here or login with your account Click here.

collapse

Support us!

Support membergroup

* User Info

 
 
Welcome, Guest. Please login or register.
Did you miss your activation email?

* Who's Online

  • Dot Guests: 391
  • Dot Spiders: 0
  • Dot Hidden: 0
  • Dot Users: 0

There aren't any users online.

Author Topic: How to Install MySQL on CentOS 7  (Read 4340 times)

0 Members and 1 Guest are viewing this topic.

Offline Nefer

  • *
  • Posts: 276
  • Karma: +0/-0
  • Gender: Male
  • Electric & Electronic engineer
    • Interlude c6 project
How to Install MySQL on CentOS 7
« on: February 18, 2017, 11:17:07 AM »
CREDITS
https://www.linode.com/docs/databases/mysql/how-to-install-mysql-on-centos-7

Basic guide how to configure/secure/optimize mysql on OS CentOS 7

MySQL is a popular database management system used for web and server applications. However, MySQL is no longer in CentOS’s repositories and MariaDB has become the default database system offered. MariaDB is considered a drop-in replacement for MySQL and would be sufficient if you just need a database system in general. See our MariaDB in CentOS 7 guide for installation instructions.
If you nonetheless prefer MySQL, this guide will introduce how to install, configure and manage it on a Linode running CentOS 7.
Large MySQL databases can require a considerable amount of memory. For this reason, we recommend using a high memory Linode for such setups.
 
This guide is written for a non-root user. Commands that require elevated privileges are prefixed with sudo. If you’re not familiar with the sudo command, you can check our Users and Groups guide.
Before You Begin
Ensure that you have followed the Getting Started and Securing Your Server guides, and the Linode’s hostname is set.
To check your hostname run:
Code: [Select]
hostname
hostname -f
The first command should show your short hostname, and the second should show your fully qualified domain name (FQDN).
Update your system:
Code: [Select]
sudo yum updateInstall MySQL
MySQL must be installed from the community repository.
Download and add the repository, then update.
Code: [Select]
wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm
sudo rpm -ivh mysql-community-release-el7-5.noarch.rpm
yum update
Install MySQL as usual and start the service. During installation, you will be asked if you want to accept the results from the .rpm file’s GPG verification. If no error or mismatch occurs, enter y.
Code: [Select]
sudo yum install mysql-server
sudo systemctl start mysqld
MySQL will bind to localhost (127.0.0.1) by default. Please reference our MySQL remote access guide for information on connecting to your databases using SSH.
 
Allowing unrestricted access to MySQL on a public IP not advised but you may change the address it listens on by modifying the bind-address parameter in /etc/my.cnf. If you decide to bind MySQL to your public IP, you should implement firewall rules that only allow connections from specific IP addresses.
Harden MySQL Server
Run the mysql_secure_installation script to address several security concerns in a default MySQL installation.
Code: [Select]
sudo mysql_secure_installationYou will be given the choice to change the MySQL root password, remove anonymous user accounts, disable root logins outside of localhost, and remove test databases. It is recommended that you answer yes to these options. You can read more about the script in in the MySQL Reference Manual.
Using MySQL
The standard tool for interacting with MySQL is the mysql client which installs with the mysql-server package. The MySQL client is used through a terminal.
Root Login
To log in to MySQL as the root user:
Code: [Select]
mysql -u root -pWhen prompted, enter the root password you assigned when the mysql_secure_installation script was run.
You’ll then be presented with a welcome header and the MySQL prompt as shown below:
Code: [Select]
mysql>
To generate a list of commands for the MySQL prompt, enter \h. You’ll then see:
Code: [Select]
List of all MySQL commands:
 Note that all text commands must be first on line and end with ';'
 ?         (\?) Synonym for `help'.
 clear     (\c) Clear command.
 connect   (\r) Reconnect to the server. Optional arguments are db and host.
 delimiter (\d) Set statement delimiter. NOTE: Takes the rest of the line as new delimiter.
 edit      (\e) Edit command with $EDITOR.
 ego       (\G) Send command to mysql server, display result vertically.
 exit      (\q) Exit mysql. Same as quit.
 go        (\g) Send command to mysql server.
 help      (\h) Display this help.
 nopager   (\n) Disable pager, print to stdout.
 notee     (\t) Don't write into outfile.
 pager     (\P) Set PAGER [to_pager]. Print the query results via PAGER.
 print     (\p) Print current command.
 prompt    (\R) Change your mysql prompt.
 quit      (\q) Quit mysql.
 rehash    (\#) Rebuild completion hash.
 source    (\.) Execute an SQL script file. Takes a file name as an argument.
 status    (\s) Get status information from the server.
 system    (\!) Execute a system shell command.
 tee       (\T) Set outfile [to_outfile]. Append everything into given outfile.
 use       (\u) Use another database. Takes database name as argument.
 charset   (\C) Switch to another charset. Might be needed for processing binlog with multi-byte charsets.
 warnings  (\W) Show warnings after every statement.
 nowarning (\w) Don't show warnings after every statement.

 For server side help, type 'help contents'

 mysql>
Create a New MySQL User and Database
In the example below, testdb is the name of the database, testuser is the user, and password is the user’s password.
Code: [Select]
create database testdb;
 create user 'testuser'@'localhost' identified by 'password';
 grant all on testdb.* to 'testuser' identified by 'password';
You can shorten this process by creating the user while assigning database permissions:
Code: [Select]
create database testdb;
 grant all on testdb.* to 'testuser' identified by 'password';
Then exit MySQL.
Code: [Select]
exitCreate a Sample Table
Log back in as testuser.
Code: [Select]
mysql -u testuser -pCreate a sample table called customers. This creates a table with a customer ID field of the type INT for integer (auto-incremented for new records, used as the primary key), as well as two fields for storing the customer’s name.
Code: [Select]
use testdb;
create table customers (customer_id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, first_name TEXT, last_name TEXT);
Then exit MySQL.
Code: [Select]
exitReset the MySQL Root Password
If you forget your root MySQL password, it can be reset.
Stop the current MySQL server instance, then restart it with an option to not ask for a password.
Code: [Select]
sudo systemctl stop mysqld
sudo mysqld_safe --skip-grant-tables &
Reconnect to the MySQL server with the MySQL root account.
Code: [Select]
mysql -u rootUse the following commands to reset root’s password. Replace password with a strong password.
Code: [Select]
use mysql;
update user SET PASSWORD=PASSWORD("password") WHERE USER='root';
flush privileges;
exit
Then restart MySQL.
Code: [Select]
sudo systemctl start mysqldTune MySQL
MySQL Tuner is a Perl script that connects to a running instance of MySQL and provides configuration recommendations based on workload. Ideally, the MySQL instance should have been operating for at least 24 hours before running the tuner. The longer the instance has been running, the better advice MySQL Tuner will give.
Download MySQL Tuner to your home directory.
Code: [Select]
wget https://raw.githubusercontent.com/major/MySQLTuner-perl/master/mysqltuner.plTo run it:
Code: [Select]
perl ./mysqltuner.plYou will be asked for the MySQL root user’s name and password. The output will show two areas of interest: General recommendations and Variables to adjust.
MySQL Tuner is an excellent starting point to optimize a MySQL server but it would be prudent to perform additional research for configurations tailored to the application(s) utilizing MySQL on your Linode.

Offline fulmoke

  • *
  • Posts: 3
  • Karma: +0/-0
Re: How to Install MySQL on CentOS 7
« Reply #1 on: February 19, 2017, 04:32:37 AM »
Thx Nefer! nice share, but i have a question, CentOS 7 is better them Debian? Which recommend?

Offline Nefer

  • *
  • Posts: 276
  • Karma: +0/-0
  • Gender: Male
  • Electric & Electronic engineer
    • Interlude c6 project
Re: How to Install MySQL on CentOS 7
« Reply #2 on: February 19, 2017, 10:58:23 AM »
Thx Nefer! nice share, but i have a question, CentOS 7 is better them Debian? Which recommend?
I Always used CentOS form my project, so im use to use it. I advice you to search on Google but you will not find an answer.

CentOS and Debian in general are the most raccomanded.

Cheers,
Nefer

Offline MarGaZeaS

  • *
  • Posts: 16
  • Karma: +0/-0
Re: How to Install MySQL on CentOS 7
« Reply #3 on: February 19, 2017, 03:01:40 PM »
thanks for the guide :D

Offline smfc

  • *
  • Posts: 111
  • Karma: +0/-0
  • Gender: Male
  • L2jFrozen Newbie
Re: How to Install MySQL on CentOS 7
« Reply #4 on: April 23, 2017, 07:13:28 PM »
i hope to soon try this out, first i simply wanted to run server on whatever has more guides - windows, when i get at least little use to it will reinstall everything completely on centOS
In Lineage 2 we trust

Offline smfc

  • *
  • Posts: 111
  • Karma: +0/-0
  • Gender: Male
  • L2jFrozen Newbie
Re: How to Install MySQL on CentOS 7
« Reply #5 on: April 28, 2017, 05:25:22 AM »
what do you use to manage database, i did install mysql on linux, for win i was using heidisql, what you suggest to use for linux?
In Lineage 2 we trust

Offline Anthony

  • *
  • Posts: 24
  • Karma: +0/-0
Re: How to Install MySQL on CentOS 7
« Reply #6 on: April 28, 2017, 09:52:06 AM »
Phpmyadmin

Offline smfc

  • *
  • Posts: 111
  • Karma: +0/-0
  • Gender: Male
  • L2jFrozen Newbie
Re: How to Install MySQL on CentOS 7
« Reply #7 on: April 28, 2017, 01:15:00 PM »
Im trying to use Dbeaver, is it worse?
In Lineage 2 we trust

 


* l2jfrozen shoutbox

Refresh History
  • Please don't use the shoutbox for question, create new topic for it!
  • ReDBullz0r: why cant i compile the pack through eclipse? its asking for a username and password
    February 04, 2024, 09:52:17 PM
  • warc222: Shyla Shyla hi why don't you start developing high five classic Interlude there are no such good builds
    January 12, 2024, 08:32:55 PM
  • warc222: lineage 2 classic interlude 110 protocol
    January 05, 2024, 03:27:23 AM
  • warc222: hi shilay, could you use Lineage 2 classic Interlude or another version of the game Lineage 2 essence as a basis?
    January 05, 2024, 03:26:04 AM
  • L2Saturn: Manye 30 years old want get some old times back, we not need kids in L2 :D Interlude BEST
    December 20, 2023, 09:33:56 PM
  • Shyla: Guys, sorry but life requires time I did not know when I started to work on frozen. Linwage had been my passion, but I have not such time to work on again. More, the game itself now is just for who played in the past, is not attractive for new generations, so I dont think it's good decision to restart to work on that
    December 18, 2023, 06:38:36 PM
  • warc222: aunty aunty when will the work be updated??
    December 17, 2023, 01:08:18 PM
  • warc222: oo hi shila, we will be waiting for you near your house with a pitchfork so that you can start doing the project again
    December 17, 2023, 01:07:22 PM
  • Shyla: I know that xD
    November 28, 2023, 01:31:06 PM
  • L2Saturn: is this project die? L2JFrozen reborn please fuck off all other Project Frozen was the best since years!
    November 22, 2023, 04:14:00 PM
  • markus24: sweep festiv
    July 05, 2023, 06:03:49 AM
  • gatos: how to compile
    October 30, 2022, 12:50:22 PM
  • criss282828: A tutorial about how to compile? What Java JDK i need? Still compile with SVN?
    April 25, 2022, 02:18:13 AM
  • Damon: [link] - INTERLUDE server FILES (Pack) Recommend our files and get a REAL MONEY: [link]
    March 16, 2022, 01:08:50 PM
  • Damon: [link] - INTERLUDE server FILES (Pack) Recommend our files and get a REAL MONEY: [link]
    March 16, 2022, 01:08:45 PM
  • Damon: [link] - INTERLUDE server FILES (Pack) Recommend our files and get a REAL MONEY: [link]
    March 16, 2022, 01:08:39 PM
  • pabblo525: donde se descarga el datapack 1.5
    February 13, 2022, 05:04:45 PM
  • Dan: I need an interlude pack with customs (acis is retail with nothing)
    November 13, 2021, 04:46:49 PM
  • Dan: is this project alive or what?
    November 13, 2021, 04:46:23 PM
  • kaisan34: Hola alguien que hable en español?
    September 25, 2021, 07:56:46 PM