CONTENTS


Lastmodified 2023-10-18 (水) 09:37:43


mariadb106-server 【Hotshot】【Piano2nd】

mysql_secure_installation 日本語訳サイト

https://freebsd.i-mks.site/sql/mariadb_install/

   46  16:22   portinstall mariadb106-server
   63  9:23    portinstall databases/phpmyadmin5

mariadb106-server phpmyadmin5 の二つをインストール後、MariaDB 初回 起動!

   81  14:14   /usr/local/etc/rc.d/mysql-server onestart
Installing MariaDB/MySQL system tables in '/var/db/mysql' ...
OK

To start mariadbd at boot time you have to copy
support-files/mariadb.service to the right place for your system


Two all-privilege accounts were created.
One is root@localhost, it has no password, but you need to
be system 'root' user to connect. Use, for example, sudo mysql
The second is mysql@localhost, it has no password either, but
you need to be the system 'mysql' user to connect.
After connecting you can set the password, if you would need to be
able to connect as any of these users with a password and without sudo

See the MariaDB Knowledgebase at https://mariadb.com/kb

You can start the MariaDB daemon with:
cd '/usr/local' ; /usr/local/bin/mariadb-safe --datadir='/var/db/mysql'

You can test the MariaDB daemon with mysql-test-run.pl
cd '/usr/local/' ; perl mariadb-test-run.pl

Please report any problems at https://mariadb.org/jira

The latest information about MariaDB is available at https://mariadb.org/.

Consider joining MariaDB's strong and vibrant community:
https://mariadb.org/get-involved/

Starting mysql.

続いて設定

# mysql_secure_installation
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
     SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the current
password for the root user. If you've just installed MariaDB, and
haven't set the root password yet, you should just press enter here.

Enter current password for root (enter for none):
OK, successfully used password, moving on...

と成功したと言っているが、実際には反映されて折らず、相変わらずパスワード無しのまま・・・なので、

alter user root@localhost identified by 'RootPassword';  ←RootPassword は、設定したいルートのパスワード

実際には、mysql 上で、コマンドを打つ。

root@localhost [(none)]> alter user root@localhost identified by '******';

を使って後で変更した。

Setting the root password or using the unix_socket ensures that nobody
can log into the MariaDB root user without the proper authorisation.

You already have your root account protected, so you can safely answer 'n'.

Switch to unix_socket authentication [Y/n]

ここで、Yとすると、phpMyAdmin からの接続で、エラーとなる。

https://webfood.info/phpmyadmin-error-2002/

unix_socket との接続になるので、

# mysql_config --socket
/var/run/mysql/mysql.sock

で、ソケットの所在を確かめた後、/usr/local/www/phpMyAdmin/config.inc.php に

//$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['connect_type'] = 'socket';
$cfg['Servers'][$i]['socket'] = '/var/run/mysql/mysql.sock';

を追加設定する。と、接続は出来るようになるが、・・・?

phpmyadmin_ng.jpeg

という不完全な表示となってしまう。普段見慣れている、

phpmyadmin_ok.jpeg

の様な表示にするには、参考サイト https://www.qnap.com/ja-jp/how-to/faq/article/phpmyadmin-%E3%81%8B%E3%82%89-mariadb-10-%E3%81%AB%E3%82%A2%E3%82%AF%E3%82%BB%E3%82%B9%E3%81%A7%E3%81%8D%E3%81%AA%E3%81%84%E3%81%AE%E3%81%AF%E3%81%AA%E3%81%9C%E3%81%A7%E3%81%99%E3%81%8B など、多数サイトをあれこれ参考にし、結果として

/usr/local/www/phpMyAdmin/config.inc.php

declare(strict_types=1);
$i = 0;

$cfg['blowfish_secret'] = 'dLJevJqAK3G9HBJKP6R6k10sNKT4s2bA';

$i++;
/* Server parameters */
$cfg['Servers'][$i]['host'] = 'localhost';
$cfg['Servers'][$i]['compress'] = false;
$cfg['Servers'][$i]['auth_type'] = 'cookie';
$cfg['Servers'][$i]['socket'] = '/var/run/mysql/mysql.sock';
$cfg['Servers'][$i]['AllowNoPassword'] = false;

/* User used to manipulate with storage */
$cfg['Servers'][$i]['controlhost'] = '';
$cfg['Servers'][$i]['controlport'] = '';
$cfg['Servers'][$i]['controluser'] = 'root';
$cfg['Servers'][$i]['controlpass'] = 'RootPassword';

/usr/local/etc/mysql/my.cnf

[client-server]
socket	= /var/run/mysql/mysql.sock
[mysqld]
port	= 3306
socket	= /var/run/mysql/mysql.sock

/usr/local/etc/mysql/conf.d/server.cnf

[mysqld]
#unix_socket=OFF
#disable_unix_socket

で、正常表示と成った様である。(;-・。・-;)


Total access 630:本日 1:昨日 0

Counter: 630, today: 1, yesterday: 0

添付ファイル: filephpmyadmin_ok.jpeg 81件 [詳細] filephpmyadmin_ng.jpeg 82件 [詳細]

トップ   編集 凍結 差分 履歴 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS
Last-modified: 2023-10-18 (水) 09:37:43