Archiv der Kategorie: MySQL/MariaDB

Updating freeradius 2.2.5 to 3

After a Debian Update to Stretch the freeradius Server with mysql database stopped working!
A short investigation I saw that the config structure change and there was no update script provided. – Ok. No Problem: Old config on the left hand – new Config on the rigth hand and after a few minutes the radius server was talking to the mysqldb/mariadb server, again. But looking to the debug log, I found some mysql insert errors.
An other a short comparission I found the changes in the database schema, especially in the accounting table (radacct), but there was als no Update script 🙁
So. here is my SQL Update for the radius database:

ALTER TABLE radacct
ADD COLUMN `acctupdatetime` datetime NULL default NULL AFTER `acctstarttime`,
ADD COLUMN `acctinterval` int(12) default NULL AFTER `acctstoptime`,
DROP COLUMN `acctstartdelay`,
DROP COLUMN `acctstopdelay`,
DROP COLUMN `xascendsessionsvrkey`,
ADD KEY `acctinterval` (acctinterval);
 
GRANT ALL PRIVILEGES ON radius.radpostauth to 'radius'@'localhost';

cmd batch script für ein MySQLdump pro DB

Falls es noch jemensch gebrauchen kann:
Hier ein kleines Script, nur batch und mysql client tools, zum dumpen aller Datenbanken in jeweils eine eigene .sql Datei

Installationsort in diesem Beispiel: c:\mysqldump

mysql.cnf

[client]
host = localhost
user = root
password = kennwort
 
[mysqldump]
host = localhost
user = root
password = kennwort

mysql.bat (Hilfsscript)

@echo off
set MYSQLBIN="C:\Program Files\MySQL\MySQL-5.6\bin"
set MYSQLCONF=C:\mysqldump\mysql.cnf
 
%MYSQLBIN%\mysql.exe --defaults-file=%MYSQLCONF% -B --skip-column-names -e "show databases"

mysqldump.bat (Hauptscript)

@echo off
set BACKUPDIR=C:\mysqldump\mysqldump
set MYSQLBIN="C:\Program Files\MySQL\MySQL-5.6\bin"
set MYSQLCONF=C:\mysqldump\mysql.cnf
 
if not exist %BACKUPDIR% mkdir %BACKUPDIR%
 
d:
cd %BACKUPDIR%
 
for /f "delims=" %%A IN ('C:\mysqldump\mysql.bat') DO (
    echo %%A
    %MYSQLBIN%\mysqldump.exe --defaults-file=%MYSQLCONF% %%A  > %BACKUPDIR%\%%A.sql
)
 
exit 0