Eu estava executando o mysqld em 14.04 com um padrão não-padrão --datadir (/ usr / local / mysqld-test) & porta (33306). Depois de atualizar para o 16.04, eu não era mais capaz de iniciar meu teste no mysqld, então, seguindo as instruções aqui e no bug ele linka para aqui , Acabei indo até:
sudo apt purge mariadb-client-10.0 mariadb-common mysql-client mysql-client-5.7 mysql-client-core-5.7 mysql-common dbconfig-mysql
sudo apt-get install mysql-client mysql-server
(No processo, ele desinstalou o amarok !? rosnar)
Isso ainda não estava funcionando, então eu acabei nuking meu todo /usr/local/mysqld-test
(intencionalmente; em teoria eu tenho scripts para reconstruí-lo). O comando mysql_install_db
que eu havia usado antes está obsoleto agora e parece não entender o argumento -P 33306
, então estou tentando usar mysqld --initialize-insecure
.
Veja o que estou fazendo:
mysqld --initialize-insecure --basedir=/usr/local/mysqld-test --datadir=/usr/local/mysqld-test/data
Falha:
mysqld: Can't create directory '/usr/local/mysqld-test/data/' (Errcode: 13 - Permission denied)
2016-11-02T10:21:37.547443Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2016-11-02T10:21:37.549183Z 0 [ERROR] Aborting
Huh. Eu pensei que fiz aquele mundo-writable:
$ ls -al /usr/local/mysqld-test
total 8
drwxrwxrwx 2 kuhrusty kuhrusty 4096 Nov 2 03:13 .
drwxr-xr-x 20 root root 4096 Nov 2 03:13 ..
WTF? Vamos tentar isso com strace
:
execve("/usr/sbin/mysqld", ["mysqld", "--initialize-insecure", "--basedir=/usr/local/mysqld-test", "--datadir=/usr/local/mysqld-test"...], [/* 69 vars */]) = 0
...
Ele grava um monte de bibliotecas compartilhadas, define alguns manipuladores de sinais e então procura por arquivos de configuração (que eu não acho que mexi - eu inicio manualmente, passando --datadir
, -P
, etc):
stat("/etc/my.cnf", 0x7ffe13e99af0) = -1 ENOENT (No such file or directory)
stat("/etc/mysql/my.cnf", {st_mode=S_IFREG|0644, st_size=682, ...}) = 0
open("/etc/mysql/my.cnf", O_RDONLY) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=682, ...}) = 0
read(3, "#\n# The MySQL database server co"..., 4096) = 682
open("/etc/mysql/conf.d/", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = 4
fstat(4, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
brk(0x271d000) = 0x271d000
getdents(4, /* 4 entries */, 32768) = 120
getdents(4, /* 0 entries */, 32768) = 0
close(4) = 0
stat("/etc/mysql/conf.d/mysql.cnf", {st_mode=S_IFREG|0644, st_size=8, ...}) = 0
open("/etc/mysql/conf.d/mysql.cnf", O_RDONLY) = 4
fstat(4, {st_mode=S_IFREG|0644, st_size=8, ...}) = 0
read(4, "[mysql]\n", 4096) = 8
read(4, "", 4096) = 0
close(4) = 0
stat("/etc/mysql/conf.d/mysqldump.cnf", {st_mode=S_IFREG|0644, st_size=55, ...}) = 0
open("/etc/mysql/conf.d/mysqldump.cnf", O_RDONLY) = 4
fstat(4, {st_mode=S_IFREG|0644, st_size=55, ...}) = 0
read(4, "[mysqldump]\nquick\nquote-names\nma"..., 4096) = 55
read(4, "", 4096) = 0
close(4) = 0
brk(0x2713000) = 0x2713000
brk(0x270a000) = 0x270a000
open("/etc/mysql/mysql.conf.d/", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = 4
fstat(4, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
getdents(4, /* 4 entries */, 32768) = 128
getdents(4, /* 0 entries */, 32768) = 0
close(4) = 0
stat("/etc/mysql/mysql.conf.d/mysqld.cnf", {st_mode=S_IFREG|0644, st_size=3028, ...}) = 0
open("/etc/mysql/mysql.conf.d/mysqld.cnf", O_RDONLY) = 4
fstat(4, {st_mode=S_IFREG|0644, st_size=3028, ...}) = 0
read(4, "#\n# The MySQL database server co"..., 4096) = 3028
read(4, "", 4096) = 0
close(4) = 0
stat("/etc/mysql/mysql.conf.d/mysqld_safe_syslog.cnf", {st_mode=S_IFREG|0644, st_size=21, ...}) = 0
open("/etc/mysql/mysql.conf.d/mysqld_safe_syslog.cnf", O_RDONLY) = 4
fstat(4, {st_mode=S_IFREG|0644, st_size=21, ...}) = 0
read(4, "[mysqld_safe]\nsyslog\n", 4096) = 21
read(4, "", 4096) = 0
close(4) = 0
read(3, "", 4096) = 0
close(3) = 0
stat("/home/kuhrusty/.my.cnf", 0x7ffe13e99af0) = -1 ENOENT (No such file or directory)
stat("/home/kuhrusty/.mylogin.cnf", 0x7ffe13e99af0) = -1 ENOENT (No such file or directory)
getrlimit(RLIMIT_NOFILE, {rlim_cur=1024, rlim_max=64*1024}) = 0
setrlimit(RLIMIT_NOFILE, {rlim_cur=5000, rlim_max=5000}) = 0
getrlimit(RLIMIT_NOFILE, {rlim_cur=5000, rlim_max=5000}) = 0
umask(026) = 02
open("/etc/localtime", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=2845, ...}) = 0
fstat(3, {st_mode=S_IFREG|0644, st_size=2845, ...}) = 0
read(3, "TZif2write(2, "mysqld: ", 8) = 8
write(2, "Can't create directory '/usr/loc"..., 87) = 87
write(2, "\n", 1) = 1
mysqld: Can't create directory '/usr/local/mysqld-test/data/' (Errcode: 13 - Permission denied)
sudo apt purge mariadb-client-10.0 mariadb-common mysql-client mysql-client-5.7 mysql-client-core-5.7 mysql-common dbconfig-mysql
sudo apt-get install mysql-client mysql-server
mysqld --initialize-insecure --basedir=/usr/local/mysqld-test --datadir=/usr/local/mysqld-test/data
mysqld: Can't create directory '/usr/local/mysqld-test/data/' (Errcode: 13 - Permission denied)
2016-11-02T10:21:37.547443Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2016-11-02T10:21:37.549183Z 0 [ERROR] Aborting
$ ls -al /usr/local/mysqld-test
total 8
drwxrwxrwx 2 kuhrusty kuhrusty 4096 Nov 2 03:13 .
drwxr-xr-x 20 root root 4096 Nov 2 03:13 ..
execve("/usr/sbin/mysqld", ["mysqld", "--initialize-insecure", "--basedir=/usr/local/mysqld-test", "--datadir=/usr/local/mysqld-test"...], [/* 69 vars */]) = 0
...
stat("/etc/my.cnf", 0x7ffe13e99af0) = -1 ENOENT (No such file or directory)
stat("/etc/mysql/my.cnf", {st_mode=S_IFREG|0644, st_size=682, ...}) = 0
open("/etc/mysql/my.cnf", O_RDONLY) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=682, ...}) = 0
read(3, "#\n# The MySQL database server co"..., 4096) = 682
open("/etc/mysql/conf.d/", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = 4
fstat(4, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
brk(0x271d000) = 0x271d000
getdents(4, /* 4 entries */, 32768) = 120
getdents(4, /* 0 entries */, 32768) = 0
close(4) = 0
stat("/etc/mysql/conf.d/mysql.cnf", {st_mode=S_IFREG|0644, st_size=8, ...}) = 0
open("/etc/mysql/conf.d/mysql.cnf", O_RDONLY) = 4
fstat(4, {st_mode=S_IFREG|0644, st_size=8, ...}) = 0
read(4, "[mysql]\n", 4096) = 8
read(4, "", 4096) = 0
close(4) = 0
stat("/etc/mysql/conf.d/mysqldump.cnf", {st_mode=S_IFREG|0644, st_size=55, ...}) = 0
open("/etc/mysql/conf.d/mysqldump.cnf", O_RDONLY) = 4
fstat(4, {st_mode=S_IFREG|0644, st_size=55, ...}) = 0
read(4, "[mysqldump]\nquick\nquote-names\nma"..., 4096) = 55
read(4, "", 4096) = 0
close(4) = 0
brk(0x2713000) = 0x2713000
brk(0x270a000) = 0x270a000
open("/etc/mysql/mysql.conf.d/", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = 4
fstat(4, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
getdents(4, /* 4 entries */, 32768) = 128
getdents(4, /* 0 entries */, 32768) = 0
close(4) = 0
stat("/etc/mysql/mysql.conf.d/mysqld.cnf", {st_mode=S_IFREG|0644, st_size=3028, ...}) = 0
open("/etc/mysql/mysql.conf.d/mysqld.cnf", O_RDONLY) = 4
fstat(4, {st_mode=S_IFREG|0644, st_size=3028, ...}) = 0
read(4, "#\n# The MySQL database server co"..., 4096) = 3028
read(4, "", 4096) = 0
close(4) = 0
stat("/etc/mysql/mysql.conf.d/mysqld_safe_syslog.cnf", {st_mode=S_IFREG|0644, st_size=21, ...}) = 0
open("/etc/mysql/mysql.conf.d/mysqld_safe_syslog.cnf", O_RDONLY) = 4
fstat(4, {st_mode=S_IFREG|0644, st_size=21, ...}) = 0
read(4, "[mysqld_safe]\nsyslog\n", 4096) = 21
read(4, "", 4096) = 0
close(4) = 0
read(3, "", 4096) = 0
close(3) = 0
stat("/home/kuhrusty/.my.cnf", 0x7ffe13e99af0) = -1 ENOENT (No such file or directory)
stat("/home/kuhrusty/.mylogin.cnf", 0x7ffe13e99af0) = -1 ENOENT (No such file or directory)
getrlimit(RLIMIT_NOFILE, {rlim_cur=1024, rlim_max=64*1024}) = 0
setrlimit(RLIMIT_NOFILE, {rlim_cur=5000, rlim_max=5000}) = 0
getrlimit(RLIMIT_NOFILE, {rlim_cur=5000, rlim_max=5000}) = 0
umask(026) = 02
open("/etc/localtime", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=2845, ...}) = 0
fstat(3, {st_mode=S_IFREG|0644, st_size=2845, ...}) = 0
read(3, "TZif2write(2, "mysqld: ", 8) = 8
write(2, "Can't create directory '/usr/loc"..., 87) = 87
write(2, "\n", 1) = 1
mysqld: Can't create directory '/usr/local/mysqld-test/data/' (Errcode: 13 - Permission denied)
%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%"..., 4096) = 2845
lseek(3, -1811, SEEK_CUR) = 1034
read(3, "TZif2%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%"..., 4096) = 1811
close(3) = 0
uname({sysname="Linux", nodename="tentacle", ...}) = 0
brk(0x2732000) = 0x2732000
brk(0x2724000) = 0x2724000
lstat("/usr", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
lstat("/usr/local", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
lstat("/usr/local/mysqld-test", {st_mode=S_IFDIR|0777, st_size=4096, ...}) = 0
lstat("/usr", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
lstat("/usr/local", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
lstat("/usr/local/mysqld-test", {st_mode=S_IFDIR|0777, st_size=4096, ...}) = 0
lstat("/usr/local/mysqld-test/data", 0x7ffe13e9d1d0) = -1 ENOENT (No such file or directory)
open("/usr/share/mysql/english/errmsg.sys", O_RDONLY) = 3
read(3, "66%pre%5%pre%08%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%", 32) = 32
read(3, "%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%D%pre%%pre%%pre%m%pre%%pre%%pre%1%pre%%pre%%pre%"..., 4320) = 4320
read(3, "hashchk%pre%isamchk%pre%NO%pre%YES%pre%Can't cre"..., 71389) = 71389
close(3) = 0
stat("/usr/local/mysqld-test/share/mysql/charsets/Index.xml", 0x7ffe13e9e2e0) = -1 ENOENT (No such file or directory)
futex(0x1ddcf48, FUTEX_WAKE_PRIVATE, 2147483647) = 0
brk(0x2745000) = 0x2745000
open("/usr/local/mysqld-test/data/", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
mkdir("/usr/local/mysqld-test/data/", 0750) = -1 EACCES (Permission denied)
%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%"..., 4096) = 2845
lseek(3, -1811, SEEK_CUR) = 1034
read(3, "TZif2%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%"..., 4096) = 1811
close(3) = 0
uname({sysname="Linux", nodename="tentacle", ...}) = 0
brk(0x2732000) = 0x2732000
brk(0x2724000) = 0x2724000
lstat("/usr", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
lstat("/usr/local", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
lstat("/usr/local/mysqld-test", {st_mode=S_IFDIR|0777, st_size=4096, ...}) = 0
lstat("/usr", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
lstat("/usr/local", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
lstat("/usr/local/mysqld-test", {st_mode=S_IFDIR|0777, st_size=4096, ...}) = 0
lstat("/usr/local/mysqld-test/data", 0x7ffe13e9d1d0) = -1 ENOENT (No such file or directory)
open("/usr/share/mysql/english/errmsg.sys", O_RDONLY) = 3
read(3, "66%pre%5%pre%08%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%", 32) = 32
read(3, "%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%D%pre%%pre%%pre%m%pre%%pre%%pre%1%pre%%pre%%pre%"..., 4320) = 4320
read(3, "hashchk%pre%isamchk%pre%NO%pre%YES%pre%Can't cre"..., 71389) = 71389
close(3) = 0
stat("/usr/local/mysqld-test/share/mysql/charsets/Index.xml", 0x7ffe13e9e2e0) = -1 ENOENT (No such file or directory)
futex(0x1ddcf48, FUTEX_WAKE_PRIVATE, 2147483647) = 0
brk(0x2745000) = 0x2745000
open("/usr/local/mysqld-test/data/", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
mkdir("/usr/local/mysqld-test/data/", 0750) = -1 EACCES (Permission denied)
OK, agora, eu acho que é onde as coisas dão errado ( nota: certifique-se de rolar para baixo) ... mas por quê? Qualquer pessoa pode criar um arquivo lá!
%pre%
WTF ?? Com este problema, o 14.04 - > Atualização 16.04 agora classifica como sobre o terceiro maior erro da minha vida ... Eu sinto como se tivesse sofrido uma daquelas lesões cerebrais traumáticas, onde você esquece como ler. Essas permissões estão certas, certo ?? A execução de mysqld --initialize
em sudo
não faz diferença. Existe alguma coisa incrivelmente idiota que estou fazendo errado?