Advertisement
Guest User

mysql_secure install

a guest
Oct 3rd, 2021
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 3.10 KB | None | 0 0
  1. pi@raspberrypi:~ $ sudo mysql_secure_installation
  2.  
  3. NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
  4.       SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!
  5.  
  6. In order to log into MariaDB to secure it, we'll need the current
  7. password for the root user.  If you've just installed MariaDB, and
  8. you haven't set the root password yet, the password will be blank,
  9. so you should just press enter here.
  10.  
  11. Enter current password for root (enter for none):
  12. OK, successfully used password, moving on...
  13.  
  14. Setting the root password ensures that nobody can log into the MariaDB
  15. root user without the proper authorisation.
  16.  
  17. Set root password? [Y/n] y
  18. New password:
  19. Re-enter new password:
  20. Password updated successfully!
  21. Reloading privilege tables..
  22. ... Success!
  23.  
  24.  
  25. By default, a MariaDB installation has an anonymous user, allowing anyone
  26. to log into MariaDB without having to have a user account created for
  27. them.  This is intended only for testing, and to make the installation
  28. go a bit smoother.  You should remove them before moving into a
  29. production environment.
  30.  
  31. Remove anonymous users? [Y/n] y
  32. ... Success!
  33.  
  34. Normally, root should only be allowed to connect from 'localhost'.  This
  35. ensures that someone cannot guess at the root password from the network.
  36.  
  37. Disallow root login remotely? [Y/n] n
  38. ... skipping.
  39.  
  40. By default, MariaDB comes with a database named 'test' that anyone can
  41. access.  This is also intended only for testing, and should be removed
  42. before moving into a production environment.
  43.  
  44. Remove test database and access to it? [Y/n] y
  45. - Dropping test database...
  46. ... Success!
  47. - Removing privileges on test database...
  48. ... Success!
  49.  
  50. Reloading the privilege tables will ensure that all changes made so far
  51. will take effect immediately.
  52.  
  53. Reload privilege tables now? [Y/n] y
  54. ... Success!
  55.  
  56. Cleaning up...
  57.  
  58. All done!  If you've completed all of the above steps, your MariaDB
  59. installation should now be secure.
  60.  
  61. Thanks for using MariaDB!
  62. pi@raspberrypi:~ $ sudo mysql -u root -p
  63. Enter password:
  64. Welcome to the MariaDB monitor.  Commands end with ; or \g.
  65. Your MariaDB connection id is 56
  66. Server version: 10.3.29-MariaDB-0+deb10u1 Raspbian 10
  67.  
  68. Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
  69.  
  70. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
  71.  
  72. MariaDB [(none)]> USE mysql;
  73. Reading table information for completion of table and column names
  74. You can turn off this feature to get a quicker startup with -A
  75.  
  76. Database changed
  77. MariaDB [mysql]> UPDATE user SET plugin='mysql_native_password' WHERE User='root';
  78. Query OK, 1 row affected (0.001 sec)
  79. Rows matched: 1  Changed: 1  Warnings: 0
  80.  
  81. MariaDB [mysql]> FLUSH PRIVILEGES;
  82. Query OK, 0 rows affected (0.001 sec)
  83.  
  84. MariaDB [mysql]> exit;
  85. Bye
  86. pi@raspberrypi:~ $ sudo nano /etc/nginx/nginx.conf
  87. pi@raspberrypi:~ $ sudo nginx -t
  88. nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
  89. nginx: configuration file /etc/nginx/nginx.conf test is successful
  90. pi@raspberrypi:~ $ sudo nano /etc/nginx/nginx.conf
  91. pi@raspberrypi:~ $ sudo systemctl restart nginx
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement