MySQL Password and Permissions - akoston/McK-CCDC GitHub Wiki

MySQL Password and Permissions (Ubuntu/Debian)

Set 'root' Password

mysql -V (Version)
mysql -u root
<= 5.7.5
	mysql> SET PASSWORD FOR root@localhost = MyNewPass;
>= 5.7.6
	mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass';
(ALL)
	mysql> update user set user="dukenukem" where user="root";
	mysql> flush privileges;
	cat /dev/null > ~/.mysql_history

File Locations and Permissions

  • Executible /usr/bin/mysql root:root 755

  • Init Location /etc/init.d/mysql root:root 755

  • Database Location /var/lib/mysql mysql:mysql 755 /var/lib/mysql/mysql mysql:mysql 755 database files mysql:mysql 660

  • Configuration File Location /etc/mysql/my.cnf root:root 644 /etc/mysql/debian.cnf root:root 600 (contains clear text password)

  • Library Directory /var/lib/mysql mysql:mysql 755

Logging

/var/log/mysql			mysql:adm	2750
/var/log/mysql.err		mysql:adm	740
/var/log/mysql.log		mysql:adm	740

Service Port

3306	TCP

Disable LOAD DATA LOCAL INFILE

/etc/mysql/my.conf  [mysqld]	set variable --> local-infile=0

/etc/passwd entry

mysql:x:104:108:MySQL Server,,,:/var/lib/mysql:/bin/false