/tmp/mysql.sock file not found
second sets a symbolic link to the sock so Rails' default location for the sock is cool
mysql_config --socket sudo ln -s /var/run/mysqld/mysqld.sock /tmp/mysql.sock
2807 users tagging and storing useful source code snippets
Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world (or not, you can keep them private!)
mysql_config --socket sudo ln -s /var/run/mysqld/mysqld.sock /tmp/mysql.sock
mysql> GRANT ALL PRIVILEGES ON *.* TO 'monty'@'localhost' -> IDENTIFIED BY 'some_pass' WITH GRANT OPTION;
mysql -h localhost -u root mysql> USE mysql; mysql> UPDATE user SET Password=PASSWORD('root-pwd') WHERE user='root'; mysql> FLUSH PRIVILEGES; mysql> EXIT
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>Label</key> <string>com.mysql.MySQL</string> <key>LowPriorityIO</key> <true/> <key>ProgramArguments</key> <array> <string>/usr/local/mysql/bin/mysqld_safe</string> </array> <key>RunAtLoad</key> <true/> </dict> </plist>
ssh -2 -f -C -N user@servername.com -L 3307/127.0.0.1/3306
show create table <table_name>
mysqldump -u <username> -p -q --single-transaction <db_name> > <backup_filename>
mysql -u <username> -p <db_name> < <backup_filename>
mysqldump -u <username> -p -q --single-transaction -t <db_name> > <backup_filename>
mysql -u <username> -p <db_name> < <backup_filename>
No forking in background and verbose ssh -2 -v -c blowfish -C -N user@servername.textdrive.com -L 3370/127.0.0.1/3306 Forking in background ssh -2 -f -c blowfish -C -N user@servername.textdrive.com -L 3370/127.0.0.1/3306
mysqldump -u dbname -p username --skip-opt -B --tables wp_categories wp_comments wp_link2cat wp_links wp_options wp_post2cat wp_postmeta wp_posts wp_usermeta wp_users > wordpress.sql
ssh -f -L 3306:127.0.0.1:3306 username@servername.com sleep 120
grant select, update, create, insert, delete on database.* to username@localhost identified by ‘password‘;
mysqldump -u root -p database > filename.sql
mysql -u root -p database < filename.sql
mysqldump familyman_development -u familyman -p -d --skip-opt
# Have to do this via my Mac because of all the mirror servers # I use scp to copy from Mac to FreeBSD box # Downloaded into /usr/local/src/taballs: - php-5.2.0.tar.bz2 from http://www.php.net/downloads.php - mysql-5.0.27.tar.gz from http://dev.mysql.com/downloads/mysql/5.0.html#downloads # On FreeBSD box cd /usr/local/src cd tarballs fetch http://mirrors.cat.pdx.edu/lighttpd/lighttpd-1.4.13.tar.gz cd .. tar xzvf tarballs/php-5.2.0.tar.bz2 tar zxvf tarballs/mysql-5.0.27.tar.gz tar zxvf tarballs/lighttpd-1.4.13.tar.gz MySQL first ======================================================= # Shut down MySQL: /usr/local/mysql/bin/mysqladmin -u root -p shutdown cd mysql-5.0.27 ./configure --prefix=/usr/local/mysql \ --localstatedir=/usr/local/mysql/data \ --enable-assembler \ --with-mysqld-ldflags=-all-static CFLAGS="-O3" CXX=gcc CXXFLAGS="-O3 \ -felide-constructors -fno-exceptions -fno-rtti" # Change to root su # I like to run the process in the background (&), # redirect the output to a log file, # and tail -f the log file. # Make it: make > ~/mysql_make.log & # Watch the make: tail -f ~/mysql_make.log # Install it: make install > ~/mysql_install.log & # Watch the install: tail -f ~/mysql_install.log PHP as a CGI: ===================================================================== cd /usr/local/src/php-5.2.0 # Make sure curl is where we think it is locate curl | grep include # Configure it ./configure --with-xml --with-zlib --with-mysql=/usr/local/mysql \ --with-mysqli=/usr/local/mysql/bin/mysql_config \ --with-curl=/usr/local/include \ --enable-cgi --enable-fastcgi \ --enable-force-redirect \ > ~/phpconfig.log & tail -f ~/phpconfig.log # Edit the Makefile to eliminate duplicates in the EXTRA_LIBS line pico Makefile # New: EXTRA_LIBS = -lcrypt -lmysqlclient -liconv -lcurl -lz -lm -lxml2 -lssl -lcrypto # Make it make > ~/php_make.log & tail -f ~/php_make.log # Install it make install > ~/php_install.log & tail -f ~/php_install.log LightTPD: ================================================================= # Check requirements locate libpcre locate libz # If those aren't there, find them in ports and install cd /usr/local/src/lighttpd-1.4.11 ./configure --prefix=/usr/local --with-pcre=/usr/local # Make it make > ~/lighttpd_make.log & tail -f ~/lighttpd_make.log # Install it make install > ~/lighttpd_install.log & tail -f ~/lighttpd_install.log # Start MySQL /usr/local/etc/rc.d/mysql.server.sh start @HOSTNAME@: not found @HOSTNAME@: not found Starting MySQL. SUCCESS! # Check MySQL version /usr/local/mysql/bin/mysqladmin -v /usr/local/mysql/bin/mysqladmin Ver 8.41 Distrib 5.0.27, for unknown-freebsd6.0 on i386 # Add mysql to the path for root. cd pico .cshrc set path = (/sbin /bin /usr/sbin /usr/bin /usr/games /usr/local/sbin /usr/local/bin /usr/X11R6/bin $HOME/bin) becomes set path = (/sbin /bin /usr/sbin /usr/bin /usr/games /usr/local/sbin /usr/local/bin /usr/X11R6/bin $HOME/bin /usr/local/mysql/bin) # Use the lighttpd.conf file I have posted separately # Requires use of /var/log/lighttpd log directory mkdir /var/log/lighttpd chmod 777 /var/log/lighttpd # Test the server? lighttpd -f /usr/local/etc/lighttpd.conf ps ax | grep light 59463 ?? S 0:00.02 lighttpd -f /usr/local/etc/lighttpd.conf 59537 p0 R+ 0:00.00 grep light # To shut off the server # pid file is in /var/run/lighttpd.pid
<html> <head> <script type="text/javascript" src="modul - clock.php"></script> <script type="text/javascript"> window.onload=function(){ //functia asta porneste script-ul la incarcarea paginii. setInterval("displaytime()", 1000) } </script> </head> <body> <?php $time = "".date("d-m-Y")."<br>".date("H:i:s").""; /*NECESAR pentru a inlocui delay-ul pana ce se incarca script-ul*/?> <span id="clock" style="position:relative;"><?=$time;?></span> </body> </html>
# Create an ew classified and attach an image with it. def create image_types = ["image/jpeg", "image/pjpeg", "image/gif","image/png", "image/x-png"] @categories = Category.find(:all) @classified = Classified.new(params[:classified]) @classified.user = session[:user] unless params[:classified][:picture].blank? if (image_types.include?params[:classified][:picture].content_type.chomp) @classified.picture = params[:classified][:picture].read else @classified.errors.add(:picture, "Photo doesn't seem to be JPG, GIF, or PNG. please ensure it is a valid image file.") render :action => 'new' return end end if @classified.save redirect_to :action => 'list' else render :action => 'new' end end # Update Method So user can change the image associated with their classified def update image_types = ["image/jpeg", "image/pjpeg", "image/gif", "image/png", "image/x-png"] @classified = Classified.find(params[:id]) @categories = Category.find(:all) if @classified.update_attributes(params[:classified]) unless params[:classified][:picture].blank? if (image_types.include?params[:classified][:picture].content_type.chomp) @classified.picture = params[:classified][:picture].read else @classified.errors.add(:picture, " doesn't seem to be JPG, GIF, or PNG. please ensure it is a valid image file.") render :action => 'edit' return end end flash[:notice] = 'Classified was successfully updated.' redirect_to :action => 'show', :id => @classified else render :action => 'edit' end end
$new_expiration_date = date('Y-m-d',mktime(0,0,0,date('m'),date('d')+60,date('Y')));
while ($row = mysql_fetch_array($query,MYSQL_NUM)) $output .= "\"" . implode("\",\"",str_replace("\r\n"," ",$row)) . "\"\r\n"; echo $output; // or write $output to a file
open up iterm change to the directory with the sql dump you want to load /usr/local/mysql/bin/mysql --user=root -p create database mydatabasename default character set utf8; use mydatabasename; source mydatabasedump.sql; show tables;
mysqldump --user=username --password=password --default-character-set=latin1 --skip-set-charset dbname > dump.sql chgrep latin1 utf8 dump.sql (OR) sed -r 's/latin1/utf8/g' dump.sql > dump_utf.sql mysql --user=username --password=password --execute="DROP DATABASE dbname; CREATE DATABASE dbname CHARACTER SET utf8 COLLATE utf8_general_ci;" mysql --user=username --password=password --default-character-set=utf8 dbname < dump.sql
SET PASSWORD FOR user@localhost = OLD_PASSWORD('password');