System information

Then connect to the database console so you can create your asterisk user and set up
permissions:
$ mysql -u root -p
Enter password:
After entering the password, you will be presented with the mysql console prompt. You
can now create your asterisk user by executing the CREATE USER command. The % is a
wildcard indicating the asterisk user can connect from any host and is IDENTIFIED BY
the password some_secret_password (which you should obviously change). Note the
trailing semicolon:
mysql> CREATE USER 'asterisk'@'%' IDENTIFIED BY 'some_secret_password';
Query OK, 0 rows affected (0.00 sec)
Let’s also create the initial database you’ll use throughout this chapter:
mysql> CREATE DATABASE asterisk;
Query OK, 1 rows affected (0.00 sec)
Now that you’ve created your user and database, you need to assign permissions for
the asterisk user to access the asterisk database:
mysql> GRANT ALL PRIVILEGES ON asterisk.* TO 'asterisk'@'%';
Query OK, 0 rows affected (0.00 sec)
Finally, exit from the console and verify that your permissions are correct by logging
back into the asterisk database as the asterisk user:
mysql> exit
Bye
# mysql -u asterisk -p asterisk
Enter password:
mysql>
You’re now ready to move on to “Installing and Configuring ODBC” on page 346.
Installing and Configuring ODBC
The ODBC connector is a database abstraction layer that makes it possible for Asterisk
to communicate with a wide range of databases without requiring the developers to
create a separate database connector for every database Asterisk wants to support. This
saves a lot of development effort and code maintenance. There is a slight performance
cost, because we are adding another application layer between Asterisk and the data-
base, but this can be mitigated with proper design and is well worth it when you need
powerful, flexible database capabilities in your Asterisk system.
Before you install the connector in Asterisk, you have to install ODBC into Linux itself.
To install the ODBC drivers, use one of the following commands.
346 | Chapter 16:Relational Database Integration