Debian 10にMySQL8をインストールMariaDBアンインストールsudo apt-get remove --purge mariadb-server-10.3 mariadb-client-10.3 mariadb-server-core-10.3 mariadb-common sudo apt-get autoremove sudo apt-get autoclean mysql-apt-configインストールmysql-apt-configとは?
手順
wget https://dev.mysql.com/get/mysql-apt-config_0.8.25-1_all.deb sudo dpk -i ./mysql-apt-config_0.8.25-1_all.deb (TUIでインストール作業をする) find /etc/apt/ -mmin -1 /etc/apt/sources.list.d /etc/apt/sources.list.d/mysql.list MySQLインストールsudo apt update sudo apt install mysql-server MySQL起動スクリプト作成- SysV init
#!/bin/sh ### BEGIN INIT INFO # Provides: mysql # Required-Start: $all # Required-Stop: $all # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: MySQL service ### END INIT INFO case "$1" in start) echo "Starting MySQL..." sudo -u mysql mysqld & ;; stop) echo "Stopping MySQL..." sudo pkill mysqld ;; restart) echo "Restarting MySQL..." sudo pkill mysqld sleep 2 sudo mysqld & ;; status) if ps aux | grep mysqld | grep -v grep > /dev/null; then echo "MySQL is running." else echo "MySQL is not running." fi ;; *) echo "Usage: /etc/init.d/mysql {start|stop|restart|status}" exit 1 ;; esac exit 0 MySQL起動、初期設定起動sudo /etc/init.d/mysql start mysql -u root -p DB、ユーザー作成CREATE DATABASE my_database; CREATE USER 'my_user'@'localhost' IDENTIFIED BY 'my_password'; GRANT ALL PRIVILEGES ON my_database.* TO 'my_user'@'localhost'; FLUSH PRIVILEGES; 接続確認mysql -u my_user -p my_database; 参考https://dev.mysql.com/doc/mysql-apt-repo-quick-guide/en/#apt-repo-setup |
|