Difference between revisions of "MySQL"
Line 93: | Line 93: | ||
and add in the line: | and add in the line: | ||
bind-address = | bind-address = 000.000.000.000 | ||
(replacing the bind-address line that might already be there...)<br> | (replacing the bind-address line that might already be there...)<br> | ||
Revision as of 00:36, 28 January 2022
11 (bullseye) |
As always...
Start with:
sudo apt update
sudo apt upgrade
MySQL on Debian
Debian does not have MySQL in its repositories... :(
We can solve this!
Check the MySQL download page for current version...
If you're happy with 8.0.28, go ahead, download & install.
(Do note: apt update
may throw errors if you don't use the latest version.)
wget https://dev.mysql.com/get/mysql-apt-config_0.8.22-1_all.deb
sudo apt install ./mysql-apt-config_0.8.22-1_all.deb
It may ask about distro version. On LMDE 4 or SparkyLinux 5, Select "debian buster" (It won't ask on Debian...)
Select "Ok"
Select "Ok"
Select "Ok"
Some versions will also ask about Configuring mysql-community-server
- Pick a good root password...
- I tend to select Use Legacy Authentication Method because Use Strong Password Encryption is annoying as hell. (Your choice here...)
Update & Upgrade everything now...
sudo apt update
sudo apt upgrade
Now you can go ahead & pretend they haven't dropped MySQL from the Debian repos...
sudo apt install mysql-server mysql-client
Configure MySQL
sudo mysql_secure_installation
- Would you like to setup VALIDATE PASSWORD component?
- I select No (because I'd rather manage my own password policies, thanks...)
- root password
- Please set the password for root here.
- Pick a good root password...
- Please set the password for root here.
- or... (depends on install...)
- Using existing password for root.
- Say No (Which actually means yes... The question being asked is "Change the password for root?")
- Using existing password for root.
- Remove anonymous users?
- Duh... Yes
- Disallow root login remotely?
- Your choice, but I tend to say No.
- Remove test database and access to it?
- Duh... Yes again.
- Reload privilege tables now?
- Yes
- Would you like to setup VALIDATE PASSWORD component?
- (Extra Instructions if you've never configured MySQL before)
Set up at least one user in mysql
sudo mysql -u root -p
CREATE USER 'USERNAME'@'localhost' IDENTIFIED BY 'PASSWORD'; FLUSH PRIVILEGES; EXIT;
(Hint: This'd be a good time to create yourself as that user with your non-admin password of choice...)
Notes about accessing the database remotely
If this is a Database server, you'll be doing the user setup again but replacing localhost with MachineName (where MachineName is the name of any remote machines that need access to your databases).
You'll also need to tell mySQL to bind to the actual network interface (or a wildcard "*").
sudo vi /etc/mysql/mysql.conf.d/mysqld.cnf
and add in the line:
bind-address = 000.000.000.000
(replacing the bind-address line that might already be there...)
On the remote machine(s), it'll be handy to install mysql-client
(at minimum, for testing...).
On Debian:
sudo apt install default-mysql-client
(which gets you the MariaDB version, but it works just fine.
On systems with mySQL in the repositories:
sudo apt install mysql-client
Either way, the command to access your database is:
mysql -h DatabaseServer -u USERNAME -p