Several MySQL commands used on command line

1) bin > mysql -h hostname -u user -p password databasename < filename or bin > mysql -h hostname -u user -p databasename < filename press “enter”, then it will show “>”, then input password.

2) mysql> CREATE DATABASE databasename;

3)
mysql> CREATE USER ‘username’@’localhost’ IDENTIFIED BY ‘password’;
mysql> GRANT ALL PRIVILEGES ON databasename.* TO ‘username’@’localhost’
-> WITH GRANT OPTION;
mysql> CREATE USER ‘username’@’%’ IDENTIFIED BY ‘password’;
mysql> GRANT ALL PRIVILEGES ON databasename.* TO ‘username’@’%’
-> WITH GRANT OPTION;

or GRANT ALL PRIVILEGES ON databasename.* TO ‘username’@’localhost’

How to use LOCK or TRANSACTION for InnoDB Engine

Run command window:

c:\xampp\mysql\bin>
command:mysql -u username -p password

Then the commands below can be used to lock/unlock table(s).

LOCK TABLES databasename.table1 WRITE, databasename.table2 WRITE;
UNLOCK TABLES;

The command is used to show the status:
SHOW ENGINE INNODB STATUS;

Below is the code to use transaction:
// Transaction
$transaction = db_transaction();

try {
db_query(‘LOCK TABLES table1 WRITE, table2 WRITE;’);
$result_list = db_query($SQL_insert);
$SQL_qurey = “select LAST_INSERT_ID() as ID”;

$tmp_result_1 = db_query($SQL_qurey);

foreach ($tmp_result_1 as $record)
$field_value_1 = $record->ID;

$SQL_insert = “INSERT INTO `table2` (`field1`, `field2`) VALUES (‘$field_value_2’, ‘$field_value_2’)”;

db_query($SQL_insert);
db_query(‘UNLOCK TABLES;’);
}
catch (Exception $e) {
$transaction->rollback();
watchdog_exception(‘Transaction’, $e);
}
// End of Transaction

Port 443 in use by “Unable to open process” with PID 4

When I tried to start Apache server in XAMPP, an error message is shown:

9:40:41 AM [Apache] Attempting to start Apache app…
9:40:41 AM [Apache] Status change detected: running
9:40:42 AM [Apache] Status change detected: stopped
9:40:42 AM [Apache] Error: Apache shutdown unexpectedly.
9:40:42 AM [Apache] This may be due to a blocked port, missing dependencies,
9:40:42 AM [Apache] improper privileges, a crash, or a shutdown by another method.
9:40:42 AM [Apache] Press the Logs button to view error logs and check
9:40:42 AM [Apache] the Windows Event Viewer for more clues
9:40:42 AM [Apache] If you need more help, copy and post this
9:40:42 AM [Apache] entire log window on the forums
9:41:41 AM [Apache] Problem detected!
9:41:41 AM [Apache] Port 443 in use by “Unable to open process” with PID 4!
9:41:41 AM [Apache] Apache WILL NOT start without the configured ports free!
9:41:41 AM [Apache] You need to uninstall/disable/reconfigure the blocking application
9:41:41 AM [Apache] or reconfigure Apache and the Control Panel to listen on a different port

I changed the port in the httpd.conf file but it didn’t work. I rebooted the computer, but it didn’t

work either.

At last, I changed the port 443 to 553 in the httpd-ssl.conf file. It works.