In today's era, technological advancements have led to rapid progress, particularly in storage media that produce crucial data and information. However, the available space for data storage is limited, and not everyone has access to high-speed internet. Therefore, transferring large amounts of data over the internet presents its own challenges. The speed of data transfer is essential for the exchange of information, especially textual data. Data compression is used to reduce the size of data by encoding information using bits or other carrier units that do not represent unencoded data within a specific coding system. MySQL databases are widely used for data management, but they face limitations in file size capacity and require fast internet access to store large amounts of data. The application of the prefix code algorithm for compressing data in MySQL database files can reduce file size without losing information, thus optimizing storage space utilization. The prefix code algorithm encodes each character of a message or data with a shorter code while preserving the information content, implemented through application design using Microsoft Visual Studio 2008. Previous research has shown the effectiveness of the prefix code algorithm in data compression, leading to improved performance and ease of application. Future research could further explore the aspects of data compression methods and their practical implications. The results of the data compression implementation using the prefix code algorithm on a MySQL file with C1 code achieved a 72% compression ratio.