MySQLでDBを作成時にエラー(You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version~)

MySQLで「wptest-data_db」の名前のデータベースを作成しようとしたら下記のエラーとなり、データベースが作成できませんでした
mysql> create databa ...Cronで、MySQLのSQLクエリを定期的に実行する

MySQLのDBのメンテンナンスで定期的にupdate, delete分を実行したい場合があります。
そのようなケースではMySQLのSQL文を実行するシェルスクリプト ...
MariaDB5.5系からMariaDB10系に移行したDBでエクスポートするとエラー

MariaDB5.5系からMariaDB10系に移行したDBでエクスポートすると下記のエラー
$ mysqldump -u root -p --all-databases >/var/tmp/dump.dbmysqldum ...MariaDB(MySQL)でレプリケーションエラー

CentOS 7がサポート終了となるので、RHEL8系のRockyLinux 8に移行する作業で、旧DBをエクスポートして新サーバーインポートすると、データベースの停止時間が長いので、一旦レプリケーションを作成して、SlaveからMa ...
新規テーブルを作成時に「Percona-XtraDB, Supports transactions, row-level locking, and foreign keys」でテーブルが作成できない

MySQLのログに下記のエラーが出て、リペアテーブルを実行しました。
231226 3:10:05 mysqld: Table './testdb/test1' is marked as crashed and should ...MariaDB でデータベースインポート時に「 ERROR 1118 (42000) ~」のエラー

CentOS 6からCentOS 8に移行したサーバーで、旧サーバーのDBをインストールしたデータベースをインポートすると「ERROR 1118 (42000) at line 1278: Row size too large (&g ...
CentOS 8系で、MariaDBを10.3から10.5にアップグレードする

CentOS 7系のサポート終了が近づいているので、RockyLinux 8に入れ替え作業を行っています。以前のサーバーではZabbixを使用していて、せっかくRHEL8系にするので、Zabbixの最新バージョンのZabbix 6.4 ...
SQL文をコマンドで実行した場合に結果のみの値を取得する

MySQL(MariaDB)で、SQL分をコマンドで実行するとカラムが表示されます。SQL分を叩く箇所をシェルスクリプト内で使いたいのでカラム無 ...
MySQLで データインポート時に 「Unknown collation: utf8mb4_unicode_520_ci」 エラー表示

他の運営しているWordpressのサイトの引っ越しする作業があり、WordPressのDBをインポートすると下記のエラーが表示されました
Unknown collation: utf8mb4_unicode_520_ci...
MySQLのデータベースの名前を変更する

データベースの名前を変更したい場合は、MySQLではリネームのコマンドがありません。
新しいDBを作成してdumpしたデータをインポートするか、RENAME TABLEコマンドを利用してリネームするしかないようです
phpMyAdminで「mysqli::real_connect(): (HY000/2002): No such file or directory」のエラー

phpMyAdminでMySQLのDBの保存場所を変更後にログインしてみると下記のように「mysqli::real_connect(): (HY000/2002): No such file or directory」とエラーが表示さ ...
MariaDBで「ERROR 1040 (08004): Too many connections」のエラー

WEBサーバーが重くてアクセスできにくいと申告があったので、下記のようにWordpressのDBにログインしようと思ったら「ERROR 1040 (08004): ...
MySQL 外部から接続できるユーザーを追加する

開発環境のDBで外部から全許可したい要望があったので、全許可できるユーザーを追加してそのユーザーは外部接続できるようにします。
まずは、現状で接続できるユーザー等を確認します
mysql> select use ...MariaDBのインストールと初期設定 | CentOS Stream 9

CentOS Stream 9にMarinaDBをインストールする方法と初期設定を説明します。CentOS Stream 9でMariaDBをインストールすると「MarinaDB 10.5」のバージョンとなります
Maria ...特定のテーブルのデータを空にする【MariaDB】

MySQL(MariaDB)で、テーブルのデータを空にするには、TRUNCATE 、DELETE を利用します。DELETE よりTRUNCATE の方が処理速度が優れているので、「TRUNCATE TABLE 」を使用したほうが良 ...