linux_wiki:install_and_configure_mariadb

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
linux_wiki:install_and_configure_mariadb [2016/10/01 15:18]
billdozor [MariaDB: Remote Client]
linux_wiki:install_and_configure_mariadb [2019/05/25 23:50] (current)
Line 7: Line 7:
 ---- ----
  
-====== MariaDB: Install and Initial Config ======+====== Lab Setup ====== 
 + 
 +The following virtual machines will be used: 
 +  * server1.example.com (192.168.1.150) -> Perform any client testing here 
 +  * server2.example.com (192.168.1.151) -> Install the database here 
 + 
 +---- 
 + 
 +====== MariaDB Server: Install and Initial Config ======
  
 Install the server and client utilities Install the server and client utilities
Line 33: Line 41:
 mysql_secure_installation mysql_secure_installation
 </code> </code>
 +  * Prompted for current root password (should be blank because of fresh install, just press ENTER)
   * Prompted to set a root password   * Prompted to set a root password
   * Other options   * Other options
Line 82: Line 91:
 <code bash> <code bash>
 MariaDB [mysql]> SHOW TABLES; MariaDB [mysql]> SHOW TABLES;
 +</code>
 +
 +----
 +
 +====== MariaDB Server: User Management ======
 +
 +Create a new user
 +<code bash>
 +MariaDB [(none)]> CREATE USER rjones@localhost IDENTIFIED by 'secret';
 +</code>
 +  * User login from any host: "rjones@'%' 
 +  * User login from specific host: "rjones@myserver1"
 +  * **HELP**<code bash>MariaDB [(none)]> help create user</code>
 +
 +\\
 +Pre-Req: Create a quick database for the user to have permissions for<code bash>MariaDB [(none)]> CREATE DATABASE mydatabase;</code>
 +
 +\\
 +Permissions for the new user
 +<code bash>
 +MariaDB [(none)]> GRANT SELECT,INSERT,UPDATE,DELETE ON mydatabase.* TO rjones@localhost;
 +</code>
 +  * Grants the commands on the database "mydatabase" and all tables (.*) in that database to rjones@localhost
 +  * **HELP**<code bash>MariaDB [(none)]> help grant</code>
 +
 +\\
 +Flush privileges
 +<code bash>
 +MariaDB [(none)]> FLUSH PRIVILEGES;
 +</code>
 +
 +\\
 +Show privileges
 +<code bash>
 +MariaDB [(none)]> SHOW GRANTS FOR rjones@localhost;
 +</code>
 +
 +\\
 +Show all users
 +<code bash>
 +MariaDB [(none)]> SELECT user,host FROM mysql.user
 </code> </code>
  
Line 105: Line 155:
 MariaDB Server: Grant privileges to root from the client IP address and flush privileges MariaDB Server: Grant privileges to root from the client IP address and flush privileges
 <code bash> <code bash>
-MariaDB [(none)]> GRANT ALL ON *.* TO root@'192.168.1.50' IDENTIFIED BY 'password-here';+MariaDB [(none)]> GRANT ALL ON *.* TO root@'192.168.1.150' IDENTIFIED BY 'password-here';
 MariaDB [(none)]> FLUSH PRIVILEGES; MariaDB [(none)]> FLUSH PRIVILEGES;
 +MariaDB [(none)]> exit
 </code> </code>
   * If you don't flush privileges, you could get inconsistent behaviour.   * If you don't flush privileges, you could get inconsistent behaviour.
 +  * The password for root and be different for this remote grant. This allows you to have different root password's depending upon the grant or if its local/remote.
 +    * FYI: 'root'@'localhost' and 'root'@'192.168.1.150' are two different user accounts.
 +
 +\\
 +MariaDB Server: Open up the firewall to allow mysql connections (if you have not already)
 +<code bash>
 +firewall-cmd --permanent --add-service=mysql
 +firewall-cmd --reload
 +</code>
  
 \\ \\
-MariaDB Remote Client: Install components to remotely manage+**MariaDB Remote Client**: Install components to remotely manage
 <code bash> <code bash>
 yum install mariadb yum install mariadb
Line 117: Line 177:
  
 \\ \\
-MariaDB Remote Client: Connect remotely+**MariaDB Remote Client**: Connect remotely
 <code bash> <code bash>
-mysql -h 192.168.1.200 -u root -p+mysql -h 192.168.1.151 -u root -p
 </code> </code>
  
Line 135: Line 195:
 skip-networking=1 skip-networking=1
 </code> </code>
 +  * Cannot even connect to 'localhost', will need to connect to the socket
  
 \\ \\
  • linux_wiki/install_and_configure_mariadb.1475349538.txt.gz
  • Last modified: 2019/05/25 23:50
  • (external edit)