XWiki Enterprise 8.4.4 Documentation » XWiki Enterprise Setup Overview » MySQL Installation and Configuration

MySQL Installation and Configuration

MySQL is available at this website

Start the MySQL Server

On a Linux machine:

If you are running MySQL as a service:

sudo service mysql start

If you are not running MySQL as a service:

sudo /etc/init.d/mysqld start

On a Windows machine:

If you are running MySQL Server as a service:

>net start mysql

If you are not running MySQL as a service, you should execute the following command to start MySQL as a standalone console application:

>mysqld --console

Check the MySQL Server

After installing MySQL, you will have to execute the following command in order to check if the MySQL server is properly started and listening for connections:

For a Linux system:

$ sudo netstat -tap | grep mysql

You should get something similar to:

tcp  0 0 localhost:mysql    *:*   LISTEN      2798/mysqld 

For a Windows system, you have to open the Command prompt as Administrator and run:

>mysqladmin -u root version

You should get something similar to:

Server version   5.5.x
Protocol version 10
Connection       localhost via TCP/IP
TCP port         3306
Uptime           2 hours 30 min

Create the "xwiki" Database

In order to create the "xwiki" database with the UTF-8 binary encoding, you have to run:

>mysql -u root -e "create database xwiki default character set utf8_bin"

You can choose another name for your database but you will have to modify the xwiki.db parameter in the xwiki.cfg file.

Display All Databases

To display all databases, you have to access the MySQL prompt:

On a Linux system:

mysql --user=root mysql
show databases;

On Windows:

>mysql -u root
mysql>show databases;

Give Privileges to the "xwiki" User

To be able to create new wikis, the MySQL user will need to have all the privileges on the database granted. You can use any username, but make sure you update the connection.username property in the hibernate.cfg.xml file.
In the following example, the username is xwiki. The command  will automatically create the xwiki user in the MySQL database:

>mysql -u root -e "grant all privileges on *.* to xwiki@localhost identified by 'xwiki'"

Create a Password For the "root" Admin Account

>mysqladmin -u root password //yourpassword//

Change or Update the "root" Password

$ mysqladmin -u root -p'oldpassword' password 'newpassword'

Create the Database Indexes

Since XWiki does not automatically create database indexes, you can use the "Admin Tools" extension available here

Increase the "max_allowed_packet" Value

By default, the value of the "max_allowed_packet" parameter is 1M. In order to increase it, you have to start the server with:

On a Linux system:

mysql --max_allowed_packet=32M

On Windows:

>mysqld --max_allowed_packet=32M

The new value can be checked by opening the MySQL prompt and by running:

mysql>show variables like 'max%'; 

You can also set this parameter by editing the my.ini file for Windows, or the /etc/my.cnf file for Linux. If this parameter is not specified, you can manually add it in the [mysqld] section.

See What Values the MySQL Server is Running

On Linux:

>mysql --user=root mysql
mysql>show variables;
 

On Windows:

>mysqladmin -u root variables 

Stop the MySQL Server

On a Linux machine:

If you are running MySQL as a service:

sudo service mysql stop

If you are not running MySQL as a service:

sudo /etc/init.d/mysqld stop

On a Windows machine:

If you are running MySQL Server as a service:

>net stop mysql

If you are not running MySQL Server as a service:

>mysqladmin -u root -p shutdown

 

Search this space