Mysql, sqlsever, oracle, redis, mongo, postgres and other database backup and recovery instructions organized_MySQL

The following only summarizes the simplest usage of each database backup and recovery. For more detailed parameters and configurations, please refer to the relevant information 1. mysql: Parameter description: $user $password $targethost $port $charset $dbname $table $filename Username Password ip(localhost) Port Encoding Database name Table name (only required for table-level backup) File name Backup: mysqldump –single-transaction -l -u $user -p'$password' -h $targethost -P $port –default-character-set=$charset $dbname $table > $filename Restore: mysql $dbname -u $user -p'$password' -h $targethost -P $port –default-character-set=$charset <$filename 2. sqlserver: Note: sqlserver2003 and below only support osql, sqlserver2005 and above support both osql and sqlcmd. The following methods are common to both sqlcmd and osql. Parameter description: $user $passwrod $instance $dbname $filename $diff_filename Username Password Instance name Database name Full backup file name Incremental backup file name Full backup: osql -U $user -P “$password” -d master -S $instance -Q “ALTER DATABASE $dbname SET OFFLINE WITH ROLLBACK IMMEDIATE; RESTORE DATABASE $dbname FROM DISK='$filename& #39; WITH REPLACE; ALTER DATABASE $dbname SET ONLINE” Incremental backup: osql -U $user -P “$password” -d master -S $instance -Q “ALTER DATABASE $dbname SET OFFLINE WITH ROLLBACK IMMEDIATE; RESTORE DATABASE $dbname FROM DISK='$ filename' WITH REPLACE,NORECOVERY; RESTORE DATABASE $dbname FROM DISK='$diff_filename' WITH RECOVERY; ALTER DATABASE…

Ubuntu11.10 compiles and installs Nginx, PHP5.3.8, MySQL, MongoDB, Memcached, SSL, SMTP

Manually compile and install nginx 1.0.5 nginx download page: http://nginx.org/en/download.htmlecho Copy the entire shell below to the command line terminal, and it will be automatically executed one by one. wget http://nginx.org/download/nginx-1.0.5.tar.gz tar -jxvf nginx-1.0.5.tar.gz cd nginx-1.0.5 sudo apt-get install libpcre3 libpcre3-dev ./configure –prefix=/usr/local/nginx make sudo make install sudo ln -s /usr/local/nginx/sbin/nginx /etc/init.d/ echo starts nginx sudo /etc/init.d/nginx Echo visits the local homepage. If it is normal, it means nginx has been started. wget -O – http://localhost/ Add Nginx to the service and start it automatically at boot. Steps: http://www.linuxidc.com/Linux/2011-10/45735.htm Manually install mysql To manually install mysql, please see: http://www.linuxidc.com/Linux/2011-06/37632.htm Manually compile and install php 5.3.8 php download page: http://php.net/downloads.php Two ways to send email in php: http://www.linuxidc.com/Linux/2011-10/45736.htm CGI, fastcgi, php-fpm: http://www.linuxidc.com/Linux/2011-10/45746.htm Commonly used extensions: curl, pdo, pdo-mysql, mysqli, openssl, gd, jpeg, png, exif, zip, magickwandsudo apt-get install libltdl-dev libssl-dev sendmail libjpeg8 libjpeg8 -dev libpng12-0 libpng12-dev libxml2-dev libcurl4-openssl-dev libmcrypt-dev sudo ln -s /usr/lib/x86_64-linux-gnu/libpng* /usr/lib/ echo According to PHP official recommendations, use mysqli and pdo_mysql instead of mysql. gmail stmp requires openssl. wget http://cn2.php.net/get/php-5.3.8.tar.bz2/from/this/mirror tar -jxvf php-5.3.8.tar.bz2 cdphp-5.3.8 ./configure –prefix=/usr/local/php –enable-fpm –with-fpm-user=www-data –with-fpm-group=www-data –with-curl –with-mcrypt –enable-mbstring –enable-pdo –with-pdo-mysql=mysqlnd –with-mysqli=mysqlnd –with-mysql=mysqlnd –with-openssl –with-imap-ssl –with-gd –with-jpeg-dir=/usr/lib/ –with-png-dir=/usr/lib/ –enable-exif –enable-zip make sudo make install sudo…

Ubuntu11.10 compiles and installs Nginx, PHP5.3.8, MySQL, MongoDB, Memcac

Manually compile and install nginx 1.0.5 nginx download page: http://nginx.org/en/download.htmlecho Copy the entire shell below to the command line terminal, and it will be automatically executed one by one. . wget http://nginx.org/download/nginx-1.0.5.tar.gz tar -jxvf nginx-1.0.5.tar.gz cd nginx-1.0.5 sudo apt-get install libpcre3 libpcre3-dev ./configure –prefix=/usr/local/nginx make sudo make install sudo ln -s /usr/local/nginx/sbin/nginx /etc/init.d/ echo starts nginx sudo /etc/init.d/nginx Echo visits the local homepage. If it is normal, it means nginx has been started. wget -O – http://localhost/ Add Nginx to the service and start it automatically at boot. Steps: http://www.linuxidc.com/Linux/2011-10/45735.htm Manually install mysql To manually install mysql, please see: http://www.linuxidc.com/Linux/2011-06/37632.htm Manually compile and install php 5.3.8 php download page: http://php.net/downloads.php Two ways to send email in php: http://www.linuxidc.com/Linux/2011-10/45736.htm CGI, fastcgi, php-fpm: http://www.linuxidc.com/Linux/2011-10/45746.htm Commonly used extensions: curl, pdo, pdo-mysql, mysqli, openssl, gd, jpeg, png, exif, zip, magickwandsudo apt-get install libltdl-dev libssl-dev sendmail libjpeg8 libjpeg8-dev libpng12-0 libpng12-dev libxml2-dev libcurl4-openssl-dev libmcrypt-dev sudo ln -s /usr/lib/x86_64-linux-gnu/libpng* /usr/lib/ echo According to the official recommendation of PHP, use mysqli and pdo_mysql instead of mysql. gmail stmp requires openssl. wget http://cn2.php.net/get/php-5.3.8.tar.bz2/from/this/mirror tar -jxvf php-5.3.8.tar.bz2 cdphp-5.3.8 ./configure –prefix=/usr/local/php —enable-fpm –with-fpm-user=www-data –with-fpm-group=www-data –with -curl –with-mcrypt –enable-mbstring –enable-pdo –with-pdo-mysql=mysqlnd –with-mysqli=mysqlnd –with-mysql=mysqlnd – -with-openssl –with-imap-ssl –with-gd –with-jpeg-dir=/usr/lib/ –with-png-dir=/usr/lib/ –enable-exif –enable -zip…

Mysql, sqlsever, oracle, redis, mongo, postgres and other database backup and recovery instructions organized_MySQL

The following only summarizes the simplest usage of each database backup and recovery. For more detailed parameters and configurations, please refer to the relevant information 1. mysql: Parameter description: $user $password $targethost $port $charset $dbname $table $filename Username Password ip(localhost) Port Encoding Database name Table name (only required for table-level backup) File name Backup: mysqldump –single-transaction -l -u $user -p'$password' -h $targethost -P $port –default-character-set=$charset $dbname $table > $filename Restore: mysql $dbname -u $user -p'$password' -h $targethost -P $port –default-character-set=$charset <$filename 2. sqlserver: Note: sqlserver2003 and below only support osql, sqlserver2005 and above support both osql and sqlcmd. The following methods are common to both sqlcmd and osql. Parameter description: $user $passwrod $instance $dbname $filename $diff_filename Username Password Instance name Database name Full backup file name Incremental backup file name Full backup: osql -U $user -P “$password” -d master -S $instance -Q “ALTER DATABASE $dbname SET OFFLINE WITH ROLLBACK IMMEDIATE; RESTORE DATABASE $dbname FROM DISK='$filename& #39; WITH REPLACE; ALTER DATABASE $dbname SET ONLINE” Incremental backup: osql -U $user -P “$password” -d master -S $instance -Q “ALTER DATABASE $dbname SET OFFLINE WITH ROLLBACK IMMEDIATE; RESTORE DATABASE $dbname FROM DISK='$ filename' WITH REPLACE,NORECOVERY; RESTORE DATABASE $dbname FROM DISK='$diff_filename' WITH RECOVERY; ALTER DATABASE…

How does django use mysql database to query the database_Mysql database usage (Django), mysql, usage, django

One-to-many: Many-party definition foreign key!! # Student model class class Student( AbstractUser): mobile = models.CharField(max_length=11, unique=True, verbose_name='Mobile phone number') cid = models.ForeignKey(to=”Class”, to_field=”id”) class Meta: db_table = 'tb_student' verbose_name = 'user' verbose_name_plural = verbose_name # Class Model Class class Class(models.Model): id = models.AutoField(primary_key=True) cname &# 61; models.CharField(max_length=32) cdata = models.DateField() Implementing many-to-one in django When specifying , the usage is as follows: st = Student( username=student_name, password=password, cid=cl # cl is an instance of Class class ) In progress When searching : # One-to-many/many-to-one cl = Banji.objects.get(id& #61;3) tea = cl.student_set.all()[0] print(tea) print(cl.student_set .first()) st = Student.objects.get(username='fenghua') print(st.cid_id) print(st.cid.cname) Related query 1. Forward search (check more than 1): Get through the foreign key of the model class (here is cid) st.cid_id Find the class id corresponding to the student There is a field to_field=id when multiple parties define foreign keys in the model st.cid.cname Find the class name corresponding to the student 2. Reverse search (1 check more): If related_name is not set in the foreign key field& #xff0c;By default, the multi-party model lowercase _set is used. If related_name=”students”, is set, students can be used directly for reverse query cl (assumed to be a class object) cl.Model name lower case_set.first()…

-underandsubcategoriesinmysqltables(coldfusion,mysql)-underandsubcategoriesinmysqltables(coldfusion,mysql)

I have a question regarding ColdFusion and Mysql. I have two tables: PRODUCT and PRODUCT_CAT. I want to list the categories that contains some of the special products that are marked as: IS_EXTRANET=1. So I wrote this query: I have a question about ColdFusion and Mysql. I have two tables: PRODUCT and PRODUCT_CAT. I want to list categories that contain some special products, which are marked with: IS_EXTRANET = 1. So I wrote this query: SELECT PC.PRODUCT_CAT,PC.PRODUCT_CATID,PC.HIERARCHY FROM PRODUCT_CAT PC LEFT OUTER JOIN PRODUCT P ON P.PRODUCT_CATID=PC.PRODUCT_CATID WHERE P.IS_EXTRANET=1 GROUP BY PC.PRODUCT_CATID,PC.PRODUCT_CAT,PC.HIERARCHY ORDER BY PC.HIERARCHY,PC.PRODUCT_CAT and the output: and output: All Categories <option value="#product_catid#" selected> #product_cat# But there is a problem. Inside the product_cat table, there are 2 types of categories: “under” and “sub”. So inside each “under” category, there are no products, but there are “sub” categories. When I try to list the categories that are only have products with the is_extranet=1 definition, there are no “under” categories listed. But I want the “under” categories listed too. In other words, if inside the “sub” category is a product with the definition is_extranet=1, then show the “under” category, then its subcategories with these products. I hope I was clear 🙂…

Repository of mongodb, redis, mysql

MongoDB is a powerful, flexible, and easy-to-extend general-purpose database MongoDB is written in C++ language and is an open source database system based on distributed file storage. Under high load conditions, adding more nodes can ensure server performance. MongoDB aims to provide scalable, high-performance data storage solutions for WEB applications. MongoDB stores data as a document, and the data structure consists of key-value (key=>value) pairs. MongoDB documents are similar to JSON objects. Field values ​​can contain other documents, arrays, and document arrays . Features of MongoDB: 1. Ease of use MongoDB is written in C++ and is an open source database system based on distributed file storage. It is not a relational database. Under high load conditions, add more More nodes can ensure server performance. MongoDB is a document-oriented database, not a relational database. The main reason for not using the relational type is to obtain better scalability. Of course there are some other benefits. Compared with relational databases, document-oriented databases no longer have “rows” The concept is replaced by a more flexible “document” model. The document-oriented approach is able to work with just one record by embedding documents and arrays in the document to represent complex hierarchical relationships, which…

mysql, redis, mongodb database installation

mysql, redis, mongodb database installation

Install mysql If there is an installation dependency error, you can first update the download source with sudo apt-get update 1. Install the server sudo apt-get install mysql-server Start service sudo service mysql start Stop the service sudo service mysql stop Restart the service sudo service mysql restart Check whether mysql exists in the process ps ajx|grep mysql 2 . MySQL configuration file The configuration file directory is /etc/mysql/mysql.cnf Enter the conf.d directory ,open mysql.cnf,found that there is no configuration Enter the mysql.conf.d directory,Open mysql.cnf,You can see the configuration items The main configuration items are as follows bind- address represents the IP bound to the server,The default is 127.0.0.1port represents the port,The default is 3306 datadir represents the database directory,The default is /var/lib/mysqlgeneral_log_file represents the normal log,The default is / var/log/mysql/mysql.loglog_error represents the error log,The default is /var/log/mysql/error.log 3. Client installation sudo apt-get install mysql-client Connect to database mysql -u username -p password Press ctrl+d or enter the following command to exit quit or exit Install redis 1. Download the installation package wget http://download.redis.io /releases/redis-4.0.9.tar.gz 2. Unzip the package tar xzf redis-4.0.9.tar.gz 3. Move,to the usr/local directory sudo mv ./redis-4.0.9 /usr/local/redis/ 4. Enter the redis directory cd /usr/local/redis/ 5. Generate…

Asp.net implements Session distributed storage (Redis, Mongodb, Mysql, etc.) sessionStateCustom

For asp.net programmers, Session storage methods include InProc, StateServer, SQLServer and Custom, but Custom is rarely mentioned. But Custom is indeed the best, the most practical and flexible way at present, because Custom can realize session storage in various situations, which is especially important for large websites. It is the best way to solve session loss and session efficiency, and it is also the best way to achieve single-use session storage. The best way to log in is to click. There are a lot of advantages and disadvantages of InProc, StateServer and SQLServer on the Internet, so I won’t explain them in detail here. Two important points 1. First of all, it’s about Session storage. Session storage is not what we imagined. When setting up Session, we immediately insert or modify data into the data container. When we get the value of Session, we immediately go to the data container to get the value. This This understanding is wrong (this is how I understood it before). Later I thought there was no need to do this, and it would greatly affect efficiency. Asp.net’s Session implementation method is to obtain data before each request, and set the Session value when the…

Backup and restoration solutions for PG, MySQL, SQLServer, Oracle, DM, Highgo, Oscar, and KingBase databases

PG&HG: #Backup ./pg_dump -c -d wangshn01 -h ip -p 5432 -U wangshn01 > /home/backup.sql #Restore ./psql -U postgres -h ip -p 5432 -d wangshn01 -f /home/backup.sql SQLServer: https://blog.csdn.net/gc_2299/article/details/80793185 Oracle: #Backup expdp test01/aaaaaa@ip/servicename directory=dir schemas=test dumpfile=20210525.dump logfile=20210525.log #Restore impdp test02/aaaaaa@ip/servicename directory=dir dumpfile=20210525.DUMP logfile=20210525.log remap_tablespace=test01:test02 remap_schema=test01:test02 table_exists_action=replace DM: #Backup ./dexp wangshn01/\”Test1027?\!\”@ip file=/home/test01.dmp log=/home/daochu.txt #Restore ./dimp wangshn01/\”Test1027?\!\”@ip fromuser=wangshn01 touser=wangshn01 table_exists_action=replace file=/home/wangshn01.dmp log=/home/daoru.txt MySQL: #Backup mysqldump -hip -uroot -ppassword –skip-lock-tables wangshn01 > /home/wangshn01.sql #Restore mysql -hip -uroot -ppassword wangshn01 </home/wangshn01.sql Oscar: #Backup ./osrexp -usysdba/”password” -hip -p2003 -dOSRDB level=schema file=/home/wangshn01.osr log=/home/wangshn01.log schema=wangshn01 #Restore ./osrimp -usysdba/”password” -hip -p2003 -dosrdb level=schema file=/home/wangshn01.osr log=/home/wangshn01.log schema=wangshn01 ignore=true nocheckvalidate=true KB: Tool backup and restore

Contact Us

Contact us

181-3619-1160

Online consultation: QQ交谈

E-mail: [email protected]

Working hours: Monday to Friday, 9:00-17:30, holidays off

Follow wechat
Scan wechat and follow us

Scan wechat and follow us

Follow Weibo
Back to top
首页
微信
电话
搜索