Category Archives: mysql

define specific location for mysql database

You can define different database location with simple symlink
create new database witrDB

$ mysql -u witr -p
> quit

list all stored databases

$ sudo ls /var/lib/mysql/

witrDB must be listed
stop mysql service

$ sudo service mysql stop

move witrDB to different location

$ sudo mv /var/lib/mysql/witrDB /drive/myDrive/myDatabases/

create symlink

$ sudo ln -s /drive/myDrive/myDatabases/witrDB /var/lib/mysql/witrDB

restart mysql service

$ sudo service mysql start

If mysql server jobs start fails:
1. ensure that linux user have rights on your new database directory

$ chown youruser.yourgroup /drive/myDrive/myDatabases/witrDB

2. look for apparmor config

$ sudo vi /etc/apparmor.d/usr.sbin.mysqld

add these two lines:
/mnt/perso/mysql.perso/ r,
/mnt/perso/mysql.perso/** rwk,

$ sudo service apparmor restart

3. restart mysql service and try again

$ sudo service mysql restart

sonarQube and sonarRunner + mysql

Analyse sonarQube standalone server :
First of all prepare your mysql user sonar :

> mysql -uroot -p

    > use mysql;
    > create user sonar identified by ‘sonar’;
    > update user set host=’%’ where user = ‘sonar’;
    > create database sonar;
    > grant all privileges on sonar.* to sonar;
    > flush privileges;
    > quit

– download
– unzip :

> unzip -d /path/where/to/extract/

– declare 
– edit /extracted/sonar/path/conf/
       1. comment     : sonar.jdbc.url:                            jdbc:h2:tcp://localhost:9092/sonar
       2. uncomment : sonar.jdbc.url:                            jdbc:mysql://[…]
– start sonar server : > /extracted/sonar/path/bin// start
– download
– unzip :

> unzip -d /path/where/to/extract/

– add environment variable SONAR_RUNNER_HOME: (ubuntu) edit /etc/environment and add SONAR_RUNNER_HOME=/sonar-runner/home/path/ 
– add $SONAR_RUNNER_HOME/bin to PATH : (ubuntu) edit /etc/environment and edit PATH
– go to your project home directory
– create file
– copy following in
# required metadata

# optional description
sonar.projectDescription=Fake description

# path to source directories (required)

# The value of the property must be the key of the language.

# Encoding of the source code

# Additional parameters

– finally analyse your project :

> sonar-runner

oublier le mot de passe root mysql ubuntu

March 29, 2012

oublier le mot de passe root mysql ubuntu:

1) sudo service mysql stop
2) sudo mysqld_safe –skip-grant-tables
3) dans un autre terminal : mysql -u root mysql
4) update user set Password=PASSWORD(‘newPassword’) where user=’root’;
4) flush privileges;
5) exit;
6) c’est tout source: