Difference between revisions of "Command line cheat sheet"

From TempusServa wiki
Jump to navigation Jump to search
old>Admin
m (21 revisions imported)
 
(19 intermediate revisions by one other user not shown)
Line 1: Line 1:
== MySQL commands ==
== MySQL commands ==


Import data from a SQL dump:
=== Import and export ===
 
Import data from a SQL dump file to a specific database:
<blockquote>
<blockquote>
mysql -uroot -pPW1234 tslive < import.sql
mysql -uroot -pPW1234 --default_character_set utf8 tslive < dumpLive.sql
</blockquote>
 
Export data to SQL dump file from selected databases
<blockquote>
mysql -uroot -pPW1234 --databases tslive tstest tsbase > dump.sql
</blockquote>
 
Export ALL data to SQL dump file
<blockquote>
mysql -uroot -pPW1234 --all-databases > dump.sql
</blockquote>
 
=== Service control [LINUX] ===
 
Start/stop server
<blockquote>sudo service mysqld start</blockquote>
<blockquote>sudo service mysqld stop</blockquote>
 
=== User management ===
 
Add extra user with readonly access to all databases
<blockquote>
mysql -uroot -pPW1234
* GRANT SELECT ON *.* TO 'remoteuser'@'195.67.11.34' IDENTIFIED BY 'PW1234';
* FLUSH PRIVILEGES;
* exit
</blockquote>
 
== Tomcat commands [LINUX] ==
 
Start/stop server
<blockquote>sudo /etc/init.d/tomcat6 stop</blockquote>
<blockquote>sudo /etc/init.d/tomcat6 start</blockquote>
 
List running applications
<blockquote>
ls -l /usr/share/tomcat/webapps/*.war
</blockquote>
 
Edit connection string
<blockquote>
sudo nano /usr/share/tomcat/conf/Catalina/localhost/TempusServa.xml
</blockquote>
 
Edit server settings
<blockquote>
sudo nano /usr/share/tomcat/conf/server.xml
</blockquote>
</blockquote>

Latest revision as of 11:51, 10 December 2021

MySQL commands

Import and export

Import data from a SQL dump file to a specific database:

mysql -uroot -pPW1234 --default_character_set utf8 tslive < dumpLive.sql

Export data to SQL dump file from selected databases

mysql -uroot -pPW1234 --databases tslive tstest tsbase > dump.sql

Export ALL data to SQL dump file

mysql -uroot -pPW1234 --all-databases > dump.sql

Service control [LINUX]

Start/stop server

sudo service mysqld start

sudo service mysqld stop

User management

Add extra user with readonly access to all databases

mysql -uroot -pPW1234

  • GRANT SELECT ON *.* TO 'remoteuser'@'195.67.11.34' IDENTIFIED BY 'PW1234';
  • FLUSH PRIVILEGES;
  • exit

Tomcat commands [LINUX]

Start/stop server

sudo /etc/init.d/tomcat6 stop

sudo /etc/init.d/tomcat6 start

List running applications

ls -l /usr/share/tomcat/webapps/*.war

Edit connection string

sudo nano /usr/share/tomcat/conf/Catalina/localhost/TempusServa.xml

Edit server settings

sudo nano /usr/share/tomcat/conf/server.xml