SSH Access Denied because Invalid User

This is an article which is made to show an alternative for describing on how to solve problems where there is an error generated by SSH utility command which is executed to remote several servers. The error is ‘access denied’ as shown below :

user@hostname:/opt$ ssh - l remoteuser@xxx.xxx.xxx.xxx
Access denied
user@hostname:/opt$  

In order to solve the problem, there are several steps which is taken as described below :

1. Check to content of /var/log/secure

Continue reading “SSH Access Denied because Invalid User”

MySQL Database generate ERROR 1452 (23000): Cannot add or update a child row: a foreign key constraint fails

This is another article written in order to handle error which is generated from MySQL Database Server. The error as specified in the title is ‘Cannot add or update a child row: a foreign key constraint fails’. The error itself is triggered when a query is being executed. In the context of this article, the query which is being executed is performed to add a record in the table.

The scenario is actually similar or in other words it is the scenario which is used in other article titled ‘MySQL Database generate ERROR 1215 (HY000): Cannot add foreign key constraint‘ which can be visited in this link.

The relationship between tables can be viewed in the following image :

MySQL Database generate ERROR 1452 (23000): Cannot add or update a child row: a foreign key constraint fails
MySQL Database generate ERROR 1452 (23000): Cannot add or update a child row: a foreign key constraint fails

Basically, the scenario is following the above ERD (Entity Relationship Diagram) with the availability of three tables. The error triggered when a query which is performed to insert a new record is being executed in table user_role. Below is the example of the query executed through MySQL Command Console :

Continue reading “MySQL Database generate ERROR 1452 (23000): Cannot add or update a child row: a foreign key constraint fails”

Installing DIA on Ubuntu16.04

DIA which is stands for Diagram Editor is a multi-purpose editor developed for editing numerous diagram such as ERD (Entity Relationship Diagram), UML or any other diagrams that can be saved and exported to other formats. Moreover, this editor is available in several operating system to be installed.

In this article, there will be steps explained to install DIA in Ubuntu 16.04 Linux Operating System. Below are those steps :

  1. First of all, the most general step is to update the operating system. The following syntax is the one which is used to perform it :
apt-get update

Below is the execution of the above command in a command prompt :

Continue reading “Installing DIA on Ubuntu16.04”

MySQL Database generate ERROR 1215 (HY000): Cannot add foreign key constraint

This is an article where the writing is made to explain and to describe a way or an alternative to handle the error generated from the execution of a query in MySQL Database. After executing a query in a SQL console which is solely to add a foreign key, the error which is shown in the title specifically stated ‘Cannot add foreign key constraint’.

The error is made in an attempt to add a foreign key which is intended for a third table in a many-to-many relationship. As we already knew, a way to handle a many-to-many relationship between two entities can be solved by creating another table which is the third one to save the identifier from each table.

Supposed if there is a table named ‘user’ and also another table named ‘role’ where a user can have many roles and a roles can be owned or possessed by many user. That condition is actually a many-to-many relationship between those two entities.

Continue reading “MySQL Database generate ERROR 1215 (HY000): Cannot add foreign key constraint”

Create Additional Table for Many to Many Relationship in MySQL Database Server

This is an article which is made to display some sort of explanation on creating an additional table for many to many relationship. As it has already known that creating additional table is necessary to describe a many to many relationship.

The scenario is described in detail as follows :

If there are many users whom are registered to a system where those users are also have lots or more than one roles in the system. Below is actually the scenario for creating the tables. In this context, the database which is used is MySQL. First of all, create the user table :

CREATE TABLE user
(  
    id INT NOT NULL AUTO_INCREMENT,
    PRIMARY KEY(id),   
    Title VARCHAR(255)
)

And after that, create the other table which is made to manage the roles available. It is shown as follows :

Continue reading “Create Additional Table for Many to Many Relationship in MySQL Database Server”

Print Available Route in Laravel

This is an article relates on the development of a web-based application using Laravel framework. It is about how to print the possible and available routes which can be used and executed to access certain pages using certain URL address.

To be able to print any available and possible URL address which is provided in the web-based application using Laravel as its framework, a built-in utility such as ‘artisan’ can be very useful to fullfil that purpose. Below is an attempt to do that :

root@hostname:/var/www/html/laravel-project# php artisan routes

                                                                  
  [Symfony\Component\Console\Exception\CommandNotFoundException]  
  Command "routes" is not defined.                                
  Did you mean one of these?                                      
      route:cache                                                 
      route:clear                                                 
      route:list                                                  
                                                                  

In the above output command, there are actually several possibilities which can be used and it will affect or functioning for different purpose.

For the above purpose which is printing the available and possible route of a web-based application developed using Laravel framework, below is the correct execution command :

Continue reading “Print Available Route in Laravel”

Alter Table Add Field after Another Field MySQL example via Command Line

This is another article related to MySQL Database Server on how to actually add field after another field by doing it via command line. That is actually an action which is going to alter or to change the table itself. Since the change is done by executing it from command line without actually using any help from Graphical MySQL Editor, every steps must be done manually.  Below are steps which must be done accordingly :

1. First of all, make sure that the service or the port listening for MySQL Database service is alive and it is in the state of listening incoming request. For details, read the article titled ‘Check MySQL Service Status‘ in this link.

2. After checking MySQL Service Status and considering that the service itself is active, try to connect to the MySQL Database Server. Read this article titled ‘Remote Execute MySQL Query via Command Line‘ which can be visited in this link. Basically, either accessing it locally or remotely, it has the same rules and syntax performed.

3. After successfully connecting to MySQL Database Remote console, try to select the associated database which has the table in it.

4. Successfully selecting the database where the table appointed to be altered the last step which is the most important part is the step for altering the table.  For an example the following is shown as follows :

A table named ‘user’ and it can be described as follow to see details of fields exist :

mysql> desc user;
+-----------+--------------+------+-----+---------+----------------+
| Field     | Type         | Null | Key | Default | Extra          |
+-----------+--------------+------+-----+---------+----------------+
| id        | int(11)      | NO   | PRI | NULL    | auto_increment |
| username  | varchar(255) | YES  |     | NULL    |                |
| password  | varchar(255) | YES  |     | NULL    |                |
+-----------+--------------+------+-----+---------+----------------+
4 rows in set (0,01 sec)

mysql>

Continue reading “Alter Table Add Field after Another Field MySQL example via Command Line”