| 88 | | [[Image(https://ws.learn.ac.lk/raw-attachment/wiki/Csle2022/Agenda/databaseandweb/web2a.png)]] |
| 89 | | [[Image(https://ws.learn.ac.lk/raw-attachment/wiki/Csle2022/Agenda/databaseandweb/web2b.png)]] |
| | 88 | {{{ |
| | 89 | |
| | 90 | |
| | 91 | NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB |
| | 92 | SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY! |
| | 93 | |
| | 94 | In order to log into MariaDB to secure it, we'll need the current |
| | 95 | password for the root user. If you've just installed MariaDB, and |
| | 96 | haven't set the root password yet, you should just press enter here. |
| | 97 | |
| | 98 | Enter current password for root (enter for none): |
| | 99 | OK, successfully used password, moving on... |
| | 100 | |
| | 101 | Setting the root password or using the unix_socket ensures that nobody |
| | 102 | can log into the MariaDB root user without the proper authorisation. |
| | 103 | |
| | 104 | You already have your root account protected, so you can safely answer 'n'. |
| | 105 | |
| | 106 | Switch to unix_socket authentication [Y/n] n |
| | 107 | ... skipping. |
| | 108 | |
| | 109 | You already have your root account protected, so you can safely answer 'n'. |
| | 110 | |
| | 111 | Change the root password? [Y/n] y |
| | 112 | New password: |
| | 113 | Re-enter new password: |
| | 114 | Password updated successfully! |
| | 115 | Reloading privilege tables.. |
| | 116 | ... Success! |
| | 117 | |
| | 118 | |
| | 119 | By default, a MariaDB installation has an anonymous user, allowing anyone |
| | 120 | to log into MariaDB without having to have a user account created for |
| | 121 | them. This is intended only for testing, and to make the installation |
| | 122 | go a bit smoother. You should remove them before moving into a |
| | 123 | production environment. |
| | 124 | |
| | 125 | Remove anonymous users? [Y/n] y |
| | 126 | ... Success! |
| | 127 | |
| | 128 | Normally, root should only be allowed to connect from 'localhost'. This |
| | 129 | ensures that someone cannot guess at the root password from the network. |
| | 130 | |
| | 131 | Disallow root login remotely? [Y/n] y |
| | 132 | ... Success! |
| | 133 | |
| | 134 | By default, MariaDB comes with a database named 'test' that anyone can |
| | 135 | access. This is also intended only for testing, and should be removed |
| | 136 | before moving into a production environment. |
| | 137 | |
| | 138 | Remove test database and access to it? [Y/n] y |
| | 139 | - Dropping test database... |
| | 140 | ... Success! |
| | 141 | - Removing privileges on test database... |
| | 142 | ... Success! |
| | 143 | |
| | 144 | Reloading the privilege tables will ensure that all changes made so far |
| | 145 | will take effect immediately. |
| | 146 | |
| | 147 | Reload privilege tables now? [Y/n] y |
| | 148 | ... Success! |
| | 149 | |
| | 150 | Cleaning up... |
| | 151 | |
| | 152 | All done! If you've completed all of the above steps, your MariaDB |
| | 153 | installation should now be secure. |
| | 154 | |
| | 155 | Thanks for using MariaDB! |
| | 156 | }}} |