On 2021-12-27 14:24, Graham Dicker wrote:
I can't get those commands to work
MariaDB [mysql]> CREATE USER 'bacula'@'localhost' IDENTIFIED BY 'xxx';
ERROR 1396 (HY000): Operation CREATE USER failed for
'bacula'@'localhost'
MariaDB [mysql]> UPDATE mysql.user SET Host='localhost' WHERE
User='bacula';
ERROR 1356 (HY000): View 'mysql.user' references invalid table(s) or
column(s)
or function(s) or definer/invoker of view lack rights to use them
If I change the Catalog definition from
dbname = "bacula"; dbuser = "bacula"; dbpassword = ""
to
dbname = "bacula"; dbuser = "root"; dbpassword = ""
then Bacula does work but it doesn't "see" the volumes already in the
database
and wants
to create new ones when I try to run a backup.
Ok, so I started mysql and went through the whole procedure on
an empty mysql instance.
Here it is...
[root@test ~]# grep -v "^#" /etc/my.cnf
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
symbolic-links=0
[mysqld_safe]
log-error=/var/log/mariadb/mariadb.log
pid-file=/var/run/mariadb/mariadb.pid
[root@test ~]# mysql -h localhost -u root
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 3
Server version: 5.5.68-MariaDB MariaDB Server
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input
statement.
MariaDB [(none)]> create user 'bacula'@'localhost' identified by 'your
password';
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> create database bacula;
Query OK, 1 row affected (0.00 sec)
MariaDB [(none)]> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| bacula |
| mysql |
| performance_schema |
| test |
+--------------------+
5 rows in set (0.00 sec)
MariaDB [(none)]> use mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
MariaDB [mysql]> select host,user from user where user='bacula';
+-----------+--------+
| host | user |
+-----------+--------+
| localhost | bacula |
+-----------+--------+
1 row in set (0.01 sec)
MariaDB [mysql]> grant all privileges on bacula.* to
'bacula'@'localhost';
Query OK, 0 rows affected (0.00 sec)
MariaDB [mysql]> exit
Bye
[root@test ~]# mysql -h localhost -u bacula -p bacula
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 4
Server version: 5.5.68-MariaDB MariaDB Server
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input
statement.
MariaDB [bacula]> show tables;
Empty set (0.00 sec)
MariaDB [bacula]> exit
Bye
## I am doing the next step in order to switch bacula support from
## postgres to mysql (on my installation default was postgres).
[root@test ~]# alternatives --config libbaccats.so
There are 3 programs which provide 'libbaccats.so'.
Selection Command
-----------------------------------------------
1 /usr/lib64/libbaccats-mysql.so
2 /usr/lib64/libbaccats-sqlite3.so
*+ 3 /usr/lib64/libbaccats-postgresql.so
Enter to keep the current selection[+], or type selection number: 1
[root@test ~]# /usr/libexec/bacula/make_mysql_tables
Creation of Bacula MySQL tables succeeded.
[root@test ~]# mysql -h localhost -u bacula -p bacula
Enter password:
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 7
Server version: 5.5.68-MariaDB MariaDB Server
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input
statement.
MariaDB [bacula]> show tables;
+------------------+
| Tables_in_bacula |
+------------------+
| BaseFiles |
| CDImages |
| Client |
| Counters |
| Device |
| File |
| FileSet |
| Filename |
| Job |
| JobHisto |
| JobMedia |
| Location |
| LocationLog |
| Log |
| Media |
| MediaType |
| Path |
| PathHierarchy |
| PathVisibility |
| Pool |
| RestoreObject |
| Snapshot |
| Status |
| Storage |
| UnsavedFiles |
| Version |
+------------------+
26 rows in set (0.00 sec)
MariaDB [bacula]> exit
Bye
[root@test ~]# /usr/libexec/bacula/grant_mysql_privileges
Created MySQL database user: bacula
## I have removed part of the output because it would only mess up
## the message without adding any value to the discussion.
Privileges for user bacula granted on database bacula.
## This is an example of data import from the bacula_db.sql file
[root@test ~]# mysql -h localhost -u bacula -p bacula < bacula_db.sql
Enter password:
[root@test ~]# echo $?
0
[root@test ~]# /usr/libexec/bacula/make_catalog_backup.pl -m MyCatalog
bacula.BaseFiles OK
bacula.CDImages OK
bacula.Client OK
bacula.Counters OK
bacula.Device OK
bacula.File OK
bacula.FileSet OK
bacula.Filename OK
bacula.Job OK
bacula.JobHisto OK
bacula.JobMedia OK
bacula.Location OK
bacula.LocationLog OK
bacula.Log OK
bacula.Media OK
bacula.MediaType OK
bacula.Path OK
bacula.PathHierarchy OK
bacula.PathVisibility OK
bacula.Pool OK
bacula.RestoreObject OK
bacula.Snapshot OK
bacula.Status OK
bacula.Storage OK
bacula.UnsavedFiles OK
bacula.Version OK
Regards!
--
Josip Deanovic
_______________________________________________
Bacula-users mailing list
Bacula-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-users