#mysqldata
Explore tagged Tumblr posts
Text
how to connect mysql.data to visual studio
1. Download and install the lastest .NET-Connector from www.mysql.com.
2. Add the MySQL.Data in Visual Studio to your project references (Menu: project, Properties, References).
1 note
·
View note
Text
《滅びの呪文》Docker Composeで作ったコンテナ、イメージ、ボリューム、ネットワークを一括完全消去する便利コマンド
from https://qiita.com/suin/items/19d65e191b96a0079417?utm_campaign=popular_items&utm_medium=feed&utm_source=popular_items
本稿ではdocker-composeで作られた、コンテナ、イメージ、ボリュームそしてネットワーク、全てを一括消去するコマンドを説明する。
一括消去するコマンド docker-compose down
docker-compose down --rmi all --volumes
実行結果の例
Stopping my-php-app_app_1 ... done Stopping my-php-app_db_1 ... done Removing my-php-app_app_1 ... done Removing my-php-app_db_1 ... done Removing network my-php-app_default Removing volume my-php-app_mysqldata Removing image mysql:8 Removing image php:7-apache
docker-compose downの説明
先程のコマンド再掲
docker-compose down --rmi all --volumes
downコマンドの特性としては、upコマンドと真逆のことをするコマンドということになる。つまり、upコマンドで作られうるもの(イメージ、コンテナ、ボリューム、ネットワーク)をすべて削除する。
--rmiオプションは、削除するイメージの種類を指定する。allはすべてのイメージ。localはフィールドにカスタムタグのないイメージのみを削除する。--rmiオプションを省略すると、イメージは消されない。
--volumesオプションは、docker-compose.ymlのvolumesセクションに書かれた名前付きボリュームとコンテナにアタッチされたanonymous volumeが削除される。
これら2つのオプションをつけないと、削除されるのはコンテナとネットワークだけとなる。
docker-compose downの使いみち
docker-compose downの使いみちとしては「開発環境を一旦クリーンにして、ゼロから作り直したい」が多いと思う。
・・・
今まで、開発環境をリセットするためにdocker-compose stopしてdocker-compose rm、docker rmi、docker volume rmのあわせ技で対応していたとしたら、ここで紹介したコマンドは代替手段としてとても役に立つと思う。
docker-compose down体験ワークショップ
docker-compose downを手元の環境で体験したい場合は、まず次の内容でdocker-compose.ymlを作成してほしい。
docker-compose.yml
version: '3.7'
services: app: image: php:7-apache depends_on: - db db: image: mysql:8 volumes: - mysqldata:/var/lib/mysql environment: MYSQL_ROOT_PASSWORD: root
volumes: mysqldata: driver: local
次に、docker-compose up -dで��段どおりに起動をかける。
$ docker-compose up -d Creating network "my-php-app_default" with the default driver Creating volume "my-php-app_mysqldata" with local driver Pulling db (mysql:8)... 8: Pulling from library/mysql Digest: sha256:01cf53f2538aa805bda591d83f107c394adca8d31f98eacd3654e282dada3193 Status: Downloaded newer image for mysql:8 Pulling app (php:7-apache)... 7-apache: Pulling from library/php Digest: sha256:205073d982746d818c3a1a546b918a4d24368a2a8cb53477ac3224efee3390d0 Status: Downloaded newer image for php:7-apache Creating my-php-app_db_1 ... done Creating my-php-app_app_1 ... done
ここで、docker-compose psしたり、docker-compose images、docker volume ls、docker network lsなどを実行してみて、イメージやボリュームが作られていることを確認してほしい。
そうしたら今度はdocker-compose down --rmi all --volumesを実行して、upで作られたものを一括削除してみよう。
$ docker-compose down --rmi all --volumes Stopping my-php-app_app_1 ... done Stopping my-php-app_db_1 ... done Removing my-php-app_app_1 ... done Removing my-php-app_db_1 ... done Removing network my-php-app_default Removing volume my-php-app_mysqldata Removing image mysql:8 Removing image php:7-apache
削除が終わったら、先程やったようにイメージやボリュームのリストを出してみて、完全消去されていることを確認してみよう。
所感
docker-composeで ・コンテナ止める ・ネットワーク削除する ・ボリューム削除する ・イメージ削除する って docker-compose down --rmi all --volumes で一括してできたのね。 こんな便利な「滅びの呪文」があるなんて知らなかった。 いちいち stop, rm などしてた……😢
— suin❄️TypeScriptが好き (@suin) September 3, 2019
0 notes
Link
via RSS feed - SEOCheckOut Here I am offering you Database (MySql) related services in which I will assist you in database operations (Data Definition and Data Manipulation Language), Database Designing OptimizationQuery Optimization Excel to MySQLData migration I will rectification of Issues. You can contact me any time. I will do my best for the sake of customer satisfaction and my profile. I have experience in database designs and database query analyzing. Feel free to contact me any time by: trajcem Created: -- Category: Programming Viewed: 37
https://ift.tt/2L0yuA3
0 notes
Text
Who's Online Script
Posted under Programming on December 31, 2006
Simple who's online script. Just add the code to your page, edit the values that need editing and then make a table in MySQL. I tested it but there might be some problems so if you find one, let me know and I'll check it. function online(){ /*This is the database info, use this to make a table in your database CREATE TABLE online ( id int(10) NOT NULL, username varchar(50) NOT NULL, ip char(50) NOT NULL, start char(50) NOT NULL ); */ #This starts the session to see who's online. global $REMOT_ADDR,$HTTP_COOKIE_VARS; #Cookie varuables for users. $id=$HTTP_COOKIE_VARS['user_id']; $username=$HTTP_COOKIE_VARS['username']; #The time $time=time(); #When the user is deleted from the database $expirytime=$time-500; #MySQL variables $mysqlhost="localhost"; $mysqluser="user"; $mysqlpass="pass"; $mysqldata="database"; $mysqltable="online"; #Nothing below this needs editing. $guest=0; $mem=0; $conn=mysql_connect("$mysqlhost","$mysqluser","$mysqlpass") or die (mysql_error()); mysql_select_db("$mysqldata") or die (mysql_error()); mysql_query("DELETE FROM $mysqltable WHERE (start < $expirytime)") or die (mysql_error()); if(!empty($id)){ mysql_query("DELETE FROM $mysqltable WHERE id='$id'") or die (mysql_error()); mysql_query("INSERT INTO $mysqltable (id,username,start) VALUES('$id','$username','$time')") or die (mysql_error()); } else{ mysql_query("DELETE FROM $mysqltable WHERE ip='$REMOTE_ADDR'") or die (mysql_error()); mysql_query("INSERT INTO $mysqltable (id,username,ip,start) VALUES('0','guest','$REMOTE_ADDR','$time')") or die (mysql_error()); } $whoison=mysql_query("SELECT * FROM $mysqltable") or die (mysql_error()); while($justwho=mysql_fetch_array($whoison)){ if($justwho['id']==0){ $guest=$guest+1; } else{ $mem=$mem+1; $who.=$justwho[username]; } }?> Who's Online Members: Guests:
0 notes