Warning: this is an htmlized version!
The original is here, and the conversion rules are here. |
####### # # E-scripts on mysql. # # Note 1: use the eev command (defined in eev.el) and the # ee alias (in my .zshrc) to execute parts of this file. # Executing this file as a whole makes no sense. # An introduction to eev can be found here: # # (find-eev-quick-intro) # http://angg.twu.net/eev-intros/find-eev-quick-intro.html # # Note 2: be VERY careful and make sure you understand what # you're doing. # # Note 3: If you use a shell other than zsh things like |& # and the for loops may not work. # # Note 4: I always run as root. # # Note 5: some parts are too old and don't work anymore. Some # never worked. # # Note 6: the definitions for the find-xxxfile commands are on my # .emacs. # # Note 7: if you see a strange command check my .zshrc -- it may # be defined there as a function or an alias. # # Note 8: the sections without dates are always older than the # sections with dates. # # This file is at <http://angg.twu.net/e/mysql.e> # or at <http://angg.twu.net/e/mysql.e.html>. # See also <http://angg.twu.net/emacs.html>, # <http://angg.twu.net/.emacs[.html]>, # <http://angg.twu.net/.zshrc[.html]>, # <http://angg.twu.net/escripts.html>, # and <http://angg.twu.net/>. # ####### # «.mysql-squeeze» (to "mysql-squeeze") # «.mysql-5.1-deb-src» (to "mysql-5.1-deb-src") # «.mysql-doc» (to "mysql-doc") # «.mysql-tutorial» (to "mysql-tutorial") # «.mysql-ref» (to "mysql-ref") # «.mysql-help» (to "mysql-help") # «.mysqldump» (to "mysqldump") # «.mysql-dump:database» (to "mysql-dump:database") # «.grant» (to "grant") # «.mysql-5.0-backports» (to "mysql-5.0-backports") # «.mysql-docs» (to "mysql-docs") # «.mysql-5.5» (to "mysql-5.5") ##### # # mysql on squeeze # 2010nov14 # ##### # «mysql-squeeze» (to ".mysql-squeeze") # (find-sh "apt-cache search mysql | sort") apti mysql-client mysql-server # (find-status "mysql-client") # (find-vldifile "mysql-client.list") # (find-udfile "mysql-client/") # (find-status "mysql-client-5.1") # (find-vldifile "mysql-client-5.1.list") # (find-udfile "mysql-client-5.1/") # (find-status "mysql-server") # (find-vldifile "mysql-server.list") # (find-udfile "mysql-server/") # (find-status "mysql-server-5.1") # (find-vldifile "mysql-server-5.1.list") # (find-udfile "mysql-server-5.1/") # (find-zsh "dmissing mysql | grep info") # (find-zsh "dmissing -i mysql | grep info") # (find-zsh "dmissing -i mysql | grep -i tut") # (find-zsh "availabledebs | sort" "mysql") # (find-zsh "availabledebs | sort | grep mysql") ##### # # mysql-5.1 (from the debian sources) # 2010nov14 # ##### # «mysql-5.1-deb-src» (to ".mysql-5.1-deb-src") # http://ftp.debian.org/debian/pool/main/m/mysql-5.1/ # http://ftp.debian.org/debian/pool/main/m/mysql-5.1/mysql-5.1_5.1.51-1.dsc # http://ftp.debian.org/debian/pool/main/m/mysql-5.1/mysql-5.1_5.1.51-1.diff.gz # http://ftp.debian.org/debian/pool/main/m/mysql-5.1/mysql-5.1_5.1.51.orig.tar.gz #* rm -Rv ~/bigsrc/mysql-5.1/ mkdir ~/bigsrc/mysql-5.1/ cd $S/http/ftp.debian.org/debian/pool/main/m/mysql-5.1/ cp -v mysql-5.1_5.1.51* ~/bigsrc/mysql-5.1/ cd ~/bigsrc/mysql-5.1/ dpkg-source -sn -x mysql-5.1_5.1.51-1.dsc cd ~/bigsrc/mysql-5.1/mysql-5.1-5.1.51/ find * | sort > .files # dpkg-buildpackage -us -uc -b -rfakeroot |& tee odb #* # (find-fline "~/bigsrc/mysql-5.1/") * (eepitch-shell) cd ~/bigsrc/mysql-5.1/ sudo dpkg -i *.deb #* # (code-c-d "mysql-5.1" "~/bigsrc/mysql-5.1/mysql-5.1-5.1.51/") # (find-mysql-5.1file "") # (find-mysql-5.1file ".files") # (find-mysql-5.1sh "grep info .files") # (find-mysql-5.1sh "grep html .files") ##### # # Apache with mod_perl (and mysql) # 2000may16 # ##### Pgrepp m/apache/ |& tee ~/o Pgrepp m/mod.perl/ |& tee ~/o # (find-fline "~/o") apti libdbd-mysql-perl apti libapache-mod-perl libdevel-symdump-perl # (find-status "libapache-mod-perl") # (find-fline "/usr/doc/libapache-mod-perl/") # (find-fline "/usr/doc/libapache-mod-perl/README.gz") # (find-fline "/usr/doc/libapache-mod-perl/examples/") # (find-vldifile "libapache-mod-perl.list") # (find-status "libdevel-symdump-perl") # (find-fline "/usr/doc/libdevel-symdump-perl/") # (find-vldifile "libdevel-symdump-perl.list") # (eeman "3pm Devel::Symdump") # (find-status "libdbi-perl") # (find-fline "/usr/doc/libdbi-perl/") # (find-fline "/usr/doc/libdbi-perl/README.gz") # (find-fline "/usr/doc/libdbi-perl/examples/") # (find-vldifile "libdbi-perl.list") # (eeman "3pm DBD::Proxy") # (eeman "3pm DBI") # (eeman "3pm DBI::DBD") # (eeman "3pm DBI::FAQ") # (eeman "3pm DBI::Format") # (eeman "3pm DBI::ProxyServer") # (eeman "3pm DBI::Shell") # (find-status "libmysqlclient6") # (find-vldifile "libmysqlclient6.list") # (find-fline "/usr/doc/libmysqlclient6/") # (find-fline "/etc/mysql/my.cnf") # (find-status "libdbd-mysql-perl") # (find-fline "/usr/doc/libdbd-mysql-perl/") # (find-fline "/usr/doc/libdbd-mysql-perl/README.gz") # (find-vldifile "libdbd-mysql-perl.list") # (eeman "3pm Mysql") # (eeman "3pm DBD::mysql") # (eeman "3pm Bundle::DBD::mysql") # (find-fline "~/TH/html.th" "mod_perl") apti mysql-client apti mysql-client mysql-server mysql-doc mysql-manual ##### # # mysql-doc # 2000may18 # ##### # «mysql-doc» (to ".mysql-doc") # (find-vldifile "mysql-doc.list") # (code-c-d "myd" "/usr/doc/mysql-doc/") # (find-mydfile "") # (find-mydfile "MySQL-for-dummies.gz") # (find-mydfile "MySQL-for-dummies.gz" "select the database 'test'") # (find-mydfile "MySQL-for-dummies.gz" 217) # (find-fline "/var/lib/mysql/") # (find-node "(mysql)Top") # (find-node "(mysql)Reference") # (find-node "(mysql)INSERT") # (find-node "(mysql)CREATE DATABASE") # (find-node "(mysql)DROP DATABASE") # (find-node "(mysql)mysqladmin") mysqladmin drop test mysqladmin create test mysqladmin extended-status mysqladmin variables # (find-node "(mysql)mysqldump") mysqldump test # (find-node "(mysql)Miscellaneous functions" "PASSWORD") # (find-node "(mysql)Entering queries") cat > ~/bin/ee.generic <<'---' --- ##### # # Following the mysql tutorial with eeg # 2000may19 # ##### # «mysql-tutorial» (to ".mysql-tutorial") # «mysql_tutorial» # This block lets us try all the examples in the "MySQL Tutorial" # section of the info docs. # Status: working! # «pets.txt» # We'll need this file. Note the tabs! (And "Whistler" became # "Whistlr" to keep a pretty alignment). #* # (find-node "(mysql)Loading tables" "tabs") cat > ~/SQL/pets.txt <<'---' Fluffy Harold cat f 1993-02-04 Claws Gwen cat m 1994-03-17 Buffy Harold dog f 1989-05-13 Fang Benny dog m 1990-08-27 Bowser Diane dog m 1998-08-31 1995-07-29 Chirpy Gwen bird f 1998-09-11 Whistlr Gwen bird \N 1997-12-09 Slim Benny snake m 1996-04-29 --- # (find-node "(mysql)Tutorial") # (find-node "(mysql)Entering queries") # (find-node "(mysql)Database use") #* # Slow test: # (find-fline "~/SQL/mysqltutor-1") # (find-fline "~/SQL/mysqltutor-2") cp -v ~/SQL/mysqltutor-1 $EEG eeg mysql -u root test cp -v ~/SQL/mysqltutor-2 $EEG eeg mysql -u root test #* # Fast test, answering all prompts immediately: (cat ~/SQL/mysqltutor-1 echo echo '###' echo '### -------- mysqltutor-2 --------' echo '###' echo cat ~/SQL/mysqltutor-2 echo -E '\q' ) > $EEG # (find-fline "$EEG") eeg -c 'set prompt "(mysql| -)>"; set fast 1' \ mysql -u root test \ |& tee ~/o # (find-fline "~/o") # (find-fline "~/o" "mysqltutor-2") #* cat > $EEG <<'---' use mysql show tables; describe columns_priv; describe db; describe func; describe host; describe tables_priv; describe user; select * from user; --- eeg mysql # ?: # cat > ~/bin/ee.generic <<'---' # --- # (find-node "(mysql)Database use") lynx /usr/doc/mysql-doc/manual.html lynx -dump /usr/doc/mysql-doc/manual.html > ~/tmp/mysql-manual.txt # (find-fline "~/tmp/mysql-manual.txt") # (find-fline "~/tmp/mysql-manual.txt" "'Y','Y','Y'") # (find-node "(mysql)Top") # (find-fline "/usr/doc/mysql-doc/") # (find-node "(mysql)News") # (find-fline "/usr/doc/mysql-doc/manual.ps") # For searches: # (find-fline "/usr/doc/mysql-doc/manual.txt.gz") # (find-fline "/usr/doc/mysql-doc/manual.texi.gz") # (find-node "(mysql)Top") # (find-node "(mysql)News") ##### # # mysql-manual # 2000may18 # ##### # (find-vldifile "mysql-manual.list") # (find-fline "/usr/doc/mysql-manual/") # (find-fline "/usr/doc/mysql-manual/README.Debian") This is some old 3rd party documentation for mysql 3.20. Mysql now has decent documentation of its own, and mysql-manual doesn't appear to be maintained at all upstream anymore. However, it might be useful for the new GPL mysql, which is based on mysql 3.20. # (w3-open-local "/usr/doc/mysql-manual/index.html") lynx /usr/doc/mysql-manual/index.html ##### # # mysql-client # 2000may18 # ##### # (find-vldifile "mysql-client.list") # (find-fline "/usr/doc/mysql-client/") # (eeman "1 mysql") ##### # # mysql-server # 2000may18 # ##### # (find-vldifile "mysql-server.list") # (find-vldifile "" "mysql-server.list") # (find-vldifile "mysql-server.preinst") # (find-vldifile "mysql-server.postinst") # (find-vldifile "mysql-server.prerm") # (find-vldifile "mysql-server.postrm") # (find-vldifile "mysql-server.templates" "purge") # (find-fline "/usr/doc/mysql-server/") # (find-fline "/usr/doc/mysql-server/README.Debian") # (find-fline "/usr/bin/mysql_install_db" "SET A PASSWORD") # (find-vldifile "libch.list") # (find-fline "/usr/doc/libch/") apti libch libdbix-easy-perl ##### # # mysql reference manual # 2007may08 # ##### # «mysql-ref» (to ".mysql-ref") # http://www.mysql.org/doc/ # http://downloads.mysql.com/docs/refman-5.0-en.html-chapter.tar.gz #* rm -Rv ~/usrc/refman-5.0-en.html-chapter/ tar -C ~/usrc/ -xvzf \ $S/http/downloads.mysql.com/docs/refman-5.0-en.html-chapter.tar.gz cd ~/usrc/refman-5.0-en.html-chapter/ #* # (code-c-d "mysqlref" "~/usrc/refman-5.0-en.html-chapter/") # (find-mysqlreffile "") # (find-mysqlrefw3m "index.html") # (find-mysqlrefw3m "tutorial.html") # (find-mysqlrefw3m "database-administration.html") # (find-mysqlrefw3m "database-administration.html#user-names") * (eepitch-shell) mysql help help show; show databases; ##### # # mysql help # 2007may11 # ##### # «mysql-help» (to ".mysql-help") # (find-angg ".emacs" "mysql") * (eepitch-mysql) \h help contents help account management help administration help table maintenance help create user help drop help drop database help grant -- (find-mysqldo "\\h") -- (find-mysqldo "help contents") -- (find-mysqldo "help grant") ##### # # mysqldump # 2007may11 # ##### # «mysqldump» (to ".mysqldump") # (find-status "mysql-client") # (find-vldifile "mysql-client.list") # (find-udfile "mysql-client/") # (find-status "mysql-client-5.0") # (find-vldifile "mysql-client-5.0.list") # (find-udfile "mysql-client-5.0/") # (find-man "1 mysqldump") # (find-man "1 mysqldumpslow") # (find-sh "mysqldump -u root baktodotest") ##### # # mysql dump: a sample database # 2007may11 # ##### # «mysql-dump:database» (to ".mysql-dump:database") # (find-mysqlrefw3m "tutorial.html" "DOUBLE(16,2)") # (find-mysqlrefw3m "index.html") # (find-mysqlrefw3m "data-types.html#numeric-type-overview") # (find-rumifile "MYSQL/policyd-db.myqsl") # (find-es "mysql" "mysql-help") * (eepitch-mysql) -- (find-mysqldo "help drop database") -- (find-mysqldo "help drop table") -- (find-mysqldo "help dump") -- (find-mysqlrefw3m "tutorial.html" "INSERT INTO shop VALUES") -- (find-mysqlrefw3m "tutorial.html" "SELECT * FROM pet;") -- (find-sh "mysqldump -u root baktodotest") -- (find-mysqldo "help create") -- (find-mysqldo "help create table") -- (find-mysqldo "help create database") -- (find-mysqldo "help delete") -- (find-mysqldo "help administrative") -- (find-mysqldo "help show create database") * (eepitch-mysql) DROP DATABASE IF EXISTS baktodotest; CREATE DATABASE baktodotest; USE baktodotest; -- Initial setting: create three tables CREATE TABLE cds ( artist CHAR(32), cd CHAR(32) ); CREATE TABLE songs ( song CHAR(32), cd CHAR(32) ); CREATE TABLE media ( cd CHAR(32), media CHAR(4) ); INSERT INTO cds VALUES ('bowie', 'low'), ('cat power', 'you are free'); INSERT INTO songs VALUES ('speed of life', 'low'), ('maybe not', 'you are free'); INSERT INTO media VALUES ('low', 'cd'), ('you are free', 'mp3s'); -- Drop one table, modify another one (even its structure), create another DROP TABLE media; DROP TABLE songs; CREATE TABLE songs ( song CHAR(32), artist CHAR(32) ); INSERT INTO songs VALUES ('speed of life', 'bowie'), ('maybe not', 'cat power'); CREATE TABLE importance ( cd CHAR(32), rating DECIMAL(3,1) ); INSERT INTO importance VALUES ('low', 10.0), ('you are free', 9.2); SELECT * FROM cds; SELECT * FROM songs; SELECT * FROM importance; ##### # # create user # 2007may19 # ##### * (eepitch-mysql) show databases; use ultramail; show tables; describe people; create user edrx; create database edrx; use mysql; show tables; describe user; describe mysql.user; * (eepitch-mysql) show databases; use mysql; show tables; describe user; select host, user from user; # (find-mysqldo "use mysql; show tables;") # (find-mysqlvdo "use mysql; show tables;") # (find-mysqldo "describe mysql.user;") # (find-mysqlvdo "describe mysql.user;") # (find-mysqlvdo "select host,user from mysql.user;") # (find-mysqlvdo "select host,user,password from mysql.user;") ##### # # grant # 2007may19 # ##### # «grant» (to ".grant") # http://www.vivaolinux.com.br/artigos/verArtigo.php?codigo=358&pagina=2 # (find-mysqldo "help insert") # (find-mysqldo "help update") # (find-mysqldo "help grant") * (eepitch-mysql) INSERT INTO user (host, user, password) VALUES ('localhost','postfix',''); UPDATE user set password=PASSWORD('senha') WHERE user='postfix'; FLUSH PRIVILEGES; GRANT select, insert, update ON mail.* TO postfix; # Beleza! Após ter criado o usuário, saia do MySQL e logue com o usuário que # você criou para testar se esta tudo certo. # mysql -D mail -u postfix -p ##### # # mysql 5.0 on sarge from the etch sources (backports) # 2007may19 # ##### # «mysql-5.0-backports» (to ".mysql-5.0-backports") #* # http://backports.org/debian/pool/main/m/mysql-dfsg-5.0/ # http://backports.org/debian/pool/main/m/mysql-dfsg-5.0/mysql-dfsg-5.0_5.0.32-7~bpo.1.dsc # http://backports.org/debian/pool/main/m/mysql-dfsg-5.0/mysql-dfsg-5.0_5.0.32-7~bpo.1.diff.gz # http://backports.org/debian/pool/main/m/mysql-dfsg-5.0/mysql-dfsg-5.0_5.0.32.orig.tar.gz apti libtool procps debhelper file libncurses5-dev perl libwrap0-dev \ zlib1g-dev libreadline5-dev psmisc po-debconf chrpath automake1.9 \ doxygen tetex-bin tetex-base tetex-extra gs dpatch gawk bison #* rm -Rv ~/bigsrc/mysql-dfsg-5.0/ mkdir ~/bigsrc/mysql-dfsg-5.0/ cd $S/http/backports.org/debian/pool/main/m/mysql-dfsg-5.0/ cp -v mysql-dfsg-5.0_5.0.32* ~/bigsrc/mysql-dfsg-5.0/ cd ~/bigsrc/mysql-dfsg-5.0/ dpkg-source -sn -x mysql-dfsg-5.0_5.0.32-7~bpo.1.dsc cd ~/bigsrc/mysql-dfsg-5.0/mysql-dfsg-5.0-5.0.32/ dpkg-buildpackage -us -uc -b -rfakeroot |& tee odb #* # http://backports.org/debian/pool/main/l/lsb/lsb-base_3.1-15~bpo.1_all.deb sudo dpkg -i \ $S/http/backports.org/debian/pool/main/l/lsb/lsb-base_3.1-15~bpo.1_all.deb #* # (find-mysqlsrcfile "") # (find-mysqlsrcfile "debian/mysql-server-4.1/DEBIAN/control") # (find-mysqlsrcsh "ls *.deb") * (eepitch-shell) cd ~/bigsrc/mysql-dfsg-5.0/ laf laf *.deb sudo dpkg -i mysql-common_* sudo dpkg -i \ libmysqlclient15-dev_*.deb \ libmysqlclient15off_*.deb \ mysql-client-5.0_*.deb \ mysql-client_*.deb \ mysql-common_*.deb \ mysql-server-5.0_*.deb \ mysql-server_*.deb # (code-c-d "mysqlsrc" "~/bigsrc/mysql-dfsg-5.0/mysql-dfsg-5.0-5.0.32/") # (find-mysqlsrcfile "") # (find-mysqlrefw3m "client-utility-programs.html#mysql") # (find-mysqlrefw3m "client-utility-programs.html#batch-commands") # (find-mysqlrefw3m "tutorial.html#batch-mode" "interactive output format") ##### # # refman-5.1-en.html-chapter # 2010nov14 # ##### # «mysql-docs» (to ".mysql-docs") # http://dev.mysql.com/doc/ # http://dev.mysql.com/doc/refman/5.1/en/index.html # http://dev.mysql.com/doc/refman/5.1/en/tutorial.html # http://downloads.mysql.com/docs/refman-5.1-en.html-chapter.tar.gz #* rm -Rv ~/bigsrc/refman-5.1-en.html-chapter/ tar -C ~/bigsrc/ -xvzf \ $S/http/downloads.mysql.com/docs/refman-5.1-en.html-chapter.tar.gz cd ~/bigsrc/refman-5.1-en.html-chapter/ #* # (code-c-d "mysqldocs" "~/bigsrc/refman-5.1-en.html-chapter/") # (find-mysqldocsfile "") # (find-mysqldocsw3m "tutorial.html") http://www.mysql.com/ http://dev.mysql.com/ http://planet.mysql.com/ ##### # # mysql 5.5 # 2014nov10 # ##### # «mysql-5.5» (to ".mysql-5.5") # (find-status "mysql-server") # (find-vldifile "mysql-server.list") # (find-udfile "mysql-server/") # (find-status "mysql-server-5.5") # (find-vldifile "mysql-server-5.5.list") # (find-udfile "mysql-server-5.5/") /home/edrx(edrx:la)# sudo apt-get install discount (...) Setting up mysql-server-5.5 (5.5.40-0+wheezy1) ... Stopping MySQL database server: mysqld. Starting MySQL database server: mysqld . . . . . . . . . . . . . . failed! invoke-rc.d: initscript mysql, action "start" failed. dpkg: error processing mysql-server-5.5 (--configure): subprocess installed post-installation script returned error exit status 1 dpkg: dependency problems prevent configuration of mysql-server: mysql-server depends on mysql-server-5.5; however: Package mysql-server-5.5 is not configured yet. dpkg: error processing mysql-server (--configure): dependency problems - leaving unconfigured Setting up libmarkdown2:i386 (2.1.3-3) ... Setting up discount (2.1.3-3) ... Errors were encountered while processing: mysql-server-5.5 mysql-server E: Sub-process /usr/bin/dpkg returned an error code (1) * (eepitch-shell) * (eepitch-kill) * (eepitch-shell) sudo dpkg --configure mysql-server-5.5 sudo dpkg --configure mysql-server http://dev.mysql.com/doc/refman/4.1/en/tutorial.html http://www.educat.hu-berlin.de/doc/mysql-faq.html http://downloads.mysql.com/docs/ http://downloads.mysql.com/docs/mysql-tutorial-excerpt-5.1-en.html-chapter.tar.gz #* * (eepitch-shell) * (eepitch-kill) * (eepitch-shell) rm -Rv /tmp/mysql-tutorial-excerpt-5.1-en.html-chapter/ tar -C /tmp/ -xvzf \ $S/http/downloads.mysql.com/docs/mysql-tutorial-excerpt-5.1-en.html-chapter.tar.gz cd /tmp/mysql-tutorial-excerpt-5.1-en.html-chapter/ #* # (code-c-d "mysqltut" "/tmp/mysql-tutorial-excerpt-5.1-en.html-chapter/") # (find-mysqltutfile "") # (find-mysqltutw3m "database-use.html") # Local Variables: # coding: utf-8-unix # End: